A Rust library that makes signaling between threads a bit more ergonomic.
Uses Condvar and Mutex under the hood to block threads without consuming CPU time.
```rust use std::sync::Arc; use std::time::Duration;
// Create the signaler and the listener let (signaler, listener) = waithandle::new();
// Signal a thread signaler.signal()?;
// Did someone signal us? if listener.check()? { println!("signal received"); }
// Wait for 5 seconds or until someone signals us if listener.wait(Duration::from_secs(5))? { println!("signal received"); } ```
```
cargo run --example simple ```
Doing some work...
Doing some work...
Doing some work...
Doing some work...
Doing some work...
Signaling thread...
Joining thread...
Someone told us to exit!
Done!