1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![deny(missing_docs)]
extern crate crossbeam;
extern crate mio;
#[macro_use]
extern crate log;
use std::sync::atomic::{AtomicU32, Ordering};
pub mod channel;
pub mod poll;
pub mod queue;
pub mod scheduler;
static NEXT_NOTIFICATION_ID: AtomicU32 = AtomicU32::new(1);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct NotificationId(u32);
impl NotificationId {
pub fn gen_next() -> NotificationId {
let id = NEXT_NOTIFICATION_ID.fetch_add(1, Ordering::SeqCst);
NotificationId(id)
}
pub fn id(&self) -> u32 {
self.0
}
}