1use futex_queue::FutexQueue;
2use std::{
3 thread,
4 time::{Duration, Instant},
5};
6
7fn main() {
8 let (tx, mut rx) = FutexQueue::<u32, 4>::new();
9 let now = Instant::now();
10
11 let thread = thread::spawn(move || loop {
12 let item = rx.recv();
13 println!(
14 "{} ms: Received: {}",
15 now.elapsed().as_millis(),
16 item.value()
17 );
18 });
19
20 tx.send(1).unwrap();
21 tx.send_scheduled(2, now + Duration::from_secs(1)).unwrap();
22 tx.send(3).unwrap();
23 tx.send_scheduled(4, now + Duration::from_secs(2)).unwrap();
24
25 thread.join().unwrap();
26}