diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs index 46fe20c6b..9895ac946 100644 --- a/examples/basic/src/main.rs +++ b/examples/basic/src/main.rs @@ -7,9 +7,9 @@ extern crate env_logger; extern crate futures; use futures::Stream; +use actix::*; use actix_web::*; -use actix::Arbiter; -use actix::actors::signal::{ProcessSignals, Subscribe}; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; use actix_web::middleware::RequestSession; use futures::future::{FutureResult, result}; @@ -96,9 +96,10 @@ fn main() { .bind("0.0.0.0:8080").unwrap() .start(); - // Subscribe to unix signals - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Starting http server: 127.0.0.1:8080"); let _ = sys.run(); diff --git a/examples/json/src/main.rs b/examples/json/src/main.rs index 5b116fc6b..907eaf51b 100644 --- a/examples/json/src/main.rs +++ b/examples/json/src/main.rs @@ -7,15 +7,14 @@ extern crate serde_json; #[macro_use] extern crate serde_derive; #[macro_use] extern crate json; - +use actix::*; use actix_web::*; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; + use bytes::BytesMut; use futures::{Future, Stream}; use json::JsonValue; -use actix::Arbiter; -use actix::actors::signal::{ProcessSignals, Subscribe}; - #[derive(Debug, Serialize, Deserialize)] struct MyObj { name: String, @@ -97,8 +96,10 @@ fn main() { .shutdown_timeout(1) .start(); - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Started http server: 127.0.0.1:8080"); let _ = sys.run(); diff --git a/examples/multipart/src/main.rs b/examples/multipart/src/main.rs index 51bf5799f..84259ec1a 100644 --- a/examples/multipart/src/main.rs +++ b/examples/multipart/src/main.rs @@ -6,11 +6,11 @@ extern crate futures; use actix::*; use actix_web::*; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; + use futures::{Future, Stream}; use futures::future::{result, Either}; -use actix::Arbiter; -use actix::actors::signal::{ProcessSignals, Subscribe}; fn index(mut req: HttpRequest) -> Box> { @@ -55,8 +55,10 @@ fn main() { .bind("127.0.0.1:8080").unwrap() .start(); - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Starting http server: 127.0.0.1:8080"); let _ = sys.run(); diff --git a/examples/signals/src/main.rs b/examples/signals/src/main.rs index 77b6b2f74..2571fdb4f 100644 --- a/examples/signals/src/main.rs +++ b/examples/signals/src/main.rs @@ -5,7 +5,7 @@ extern crate env_logger; use actix::*; use actix_web::*; -use actix::actors::signal::{ProcessSignals, Subscribe}; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; struct MyWebSocket; @@ -34,9 +34,10 @@ fn main() { .bind("127.0.0.1:8080").unwrap() .start(); - // Subscribe to unix signals - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Started http server: 127.0.0.1:8080"); let _ = sys.run(); diff --git a/examples/template_tera/src/main.rs b/examples/template_tera/src/main.rs index 3857d489f..c4f962e73 100644 --- a/examples/template_tera/src/main.rs +++ b/examples/template_tera/src/main.rs @@ -3,9 +3,10 @@ extern crate actix_web; extern crate env_logger; #[macro_use] extern crate tera; + +use actix::*; use actix_web::*; -use actix::Arbiter; -use actix::actors::signal::{ProcessSignals, Subscribe}; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; struct State { template: tera::Tera, // <- store tera template in application state @@ -42,9 +43,10 @@ fn main() { .bind("127.0.0.1:8080").unwrap() .start(); - // Subscribe to unix signals - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Started http server: 127.0.0.1:8080"); let _ = sys.run(); diff --git a/examples/tls/src/main.rs b/examples/tls/src/main.rs index bf0c3eed0..30625fdba 100644 --- a/examples/tls/src/main.rs +++ b/examples/tls/src/main.rs @@ -6,9 +6,9 @@ extern crate env_logger; use std::fs::File; use std::io::Read; +use actix::*; use actix_web::*; -use actix::Arbiter; -use actix::actors::signal::{ProcessSignals, Subscribe}; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; /// somple handle fn index(req: HttpRequest) -> Result { @@ -47,9 +47,10 @@ fn main() { .bind("127.0.0.1:8443").unwrap() .start_ssl(&pkcs12).unwrap(); - // Subscribe to unix signals - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Started http server: 127.0.0.1:8443"); let _ = sys.run(); diff --git a/examples/websocket-chat/src/main.rs b/examples/websocket-chat/src/main.rs index 39936b358..a0236cbed 100644 --- a/examples/websocket-chat/src/main.rs +++ b/examples/websocket-chat/src/main.rs @@ -17,8 +17,7 @@ use std::time::Instant; use actix::*; use actix_web::*; -use actix::Arbiter; -use actix::actors::signal::{ProcessSignals, Subscribe}; +#[cfg(target_os = "linux")] use actix::actors::signal::{ProcessSignals, Subscribe}; mod codec; mod server; @@ -216,9 +215,10 @@ fn main() { .bind("127.0.0.1:8080").unwrap() .start(); - // Subscribe to unix signals - let signals = Arbiter::system_registry().get::(); - signals.send(Subscribe(addr.subscriber())); + if cfg!(target_os = "linux") { // Subscribe to unix signals + let signals = Arbiter::system_registry().get::(); + signals.send(Subscribe(addr.subscriber())); + } println!("Started http server: 127.0.0.1:8080"); let _ = sys.run();