Implement Condvar::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.
This commit is contained in:
parent
4996052717
commit
45c7ddfea6
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
use crate::sys::sync::Mutex;
|
use crate::sys::sync::Mutex;
|
||||||
|
use crate::thread::sleep;
|
||||||
use crate::time::Duration;
|
use crate::time::Duration;
|
||||||
|
|
||||||
pub struct Condvar {}
|
pub struct Condvar {}
|
||||||
|
@ -19,7 +20,8 @@ impl Condvar {
|
||||||
panic!("condvar wait not supported")
|
panic!("condvar wait not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn wait_timeout(&self, _mutex: &Mutex, _dur: Duration) -> bool {
|
pub unsafe fn wait_timeout(&self, _mutex: &Mutex, dur: Duration) -> bool {
|
||||||
panic!("condvar wait not supported");
|
sleep(dur);
|
||||||
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue