mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-03 05:27:36 +00:00
![]() Condvar: implement wait_timeout for targets without threads This always falls back to sleeping since there is no way to notify a condvar on a target without threads. Even on a target that has no threads the following code is a legitimate use case: ```rust use std::sync::{Condvar, Mutex}; use std::time::Duration; fn main() { let cv = Condvar::new(); let mutex = Mutex::new(()); let mut guard = mutex.lock().unwrap(); cv.notify_one(); let res; (guard, res) = cv.wait_timeout(guard, Duration::from_secs(3)).unwrap(); assert!(res.timed_out()); } ``` |
||
---|---|---|
.. | ||
benches | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml |