#[macro_use] extern crate log;
extern crate uuid;
extern crate rand;
#[macro_use] extern crate lazy_static;
extern crate serde;
#[macro_use] extern crate serde_derive;
extern crate bincode;
extern crate tokio_reactor;
#[macro_use] extern crate tokio_io;
mod tokio {
pub(crate) use ::tokio_reactor as reactor;
pub(crate) use ::tokio_io as io;
#[cfg(test)]
pub(crate) use ::tokio_all::runtime;
}
extern crate futures;
#[cfg(target_os = "windows")]
extern crate winapi;
#[cfg(target_os = "windows")]
#[macro_use] extern crate winhandle;
#[cfg(target_os = "windows")]
extern crate widestring;
#[cfg(test)]
extern crate tokio as tokio_all;
mod channel;
pub mod io;
pub mod sync;
pub mod shm;
mod ser;
pub use channel::*;
pub mod os {
#[cfg(target_os = "windows")]
pub mod windows {
pub use platform::*;
}
}
#[cfg(target_os = "windows")]
#[path = "windows/mod.rs"]
mod platform;
#[cfg(unix)]
#[path = "unix/mod.rs"]
mod platform;
#[inline]
#[cfg(test)] fn align(x: usize, y: usize) -> usize {
if x > 0 && y > 0 {
(x + (y - 1)) & !(y - 1)
} else {
0
}
}
#[cfg(test)]
fn check_send(_t: &Send) {
}
#[cfg(any(test, target_os = "windows"))] const CACHE_LINE: usize = 64;
#[cfg(target_pointer_width = "32")]
const USIZE_SIZE: usize = 4;
#[cfg(target_pointer_width = "64")]
const USIZE_SIZE: usize = 8;
#[cfg(test)]
mod tests {
use super::*;
use std::{thread};
use tokio::reactor::Reactor;
#[test]
fn raw_message_channel_pair() {
let reactor = Reactor::new().unwrap();
let (_a, _b) = RawMessageChannel::pair(&reactor.handle()).unwrap();
}
#[test]
fn named_message_channel_pair() {
let reactor = Reactor::new().unwrap();
let server = platform::NamedMessageChannel::new(&reactor.handle()).unwrap();
let name = server.name().to_os_string();
println!("named socket: {:?}", name);
let client_thread = thread::spawn(move || {
let reactor = Reactor::new().unwrap();
let _client = platform::NamedMessageChannel::connect(&name, None, &reactor.handle()).unwrap();
});
let _server = server.accept(None).unwrap();
client_thread.join().unwrap();
}
}