Wait Object based on Mutex and Condvar
Provide an abstraction over Condvar + Mutex usage, as provided by the Rust document
in Condvar.
The library provides three main types: WaitEvent, ManualResetEvent, and AutoResetEvent. WaitEvent is the core
abstraction mentioned. ManualResetEvent and AutoResetEvent are just a specialization for bool type.
When compiling with Windows platform, the lib also provides windows module for native implementation of
ManualResetEvent and AutoResetEvent.
Example of the abstraction provided:
use WaitEvent;
use thread;
let wait3 = new_init;
let mut wait_handle = wait3.clone;
spawn;
let timeout = from_secs;
let r#final = *wait3.wait.unwrap;
let current = *wait3.value.unwrap;
assert_eq!;
assert_eq!;
The second is to wait and then reset the value to a desired state.
use WaitEvent;
use thread;
let wait3 = new_init;
let mut wait_handle = wait3.clone;
spawn;
let timeout = from_secs;
let r#final = wait3.wait_reset.unwrap;
let current = *wait3.value.unwrap;
assert_eq!;
assert_eq!;