about summary refs log tree commit diff
path: root/library/std/src/sys/sync
diff options
context:
space:
mode:
authorSebastian Urban <surban@surban.net>2024-12-18 11:33:15 +0100
committerSebastian Urban <surban@surban.net>2024-12-18 11:33:15 +0100
commit45c7ddfea6ba9980a1c6f4f9bd9c821e56af035e (patch)
treeafd28273ec702f408080f20114e78bd057e78f6f /library/std/src/sys/sync
parent499605271718bceaa629f0b954502c0040e4456b (diff)
downloadrust-45c7ddfea6ba9980a1c6f4f9bd9c821e56af035e.tar.gz
rust-45c7ddfea6ba9980a1c6f4f9bd9c821e56af035e.zip
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.
Diffstat (limited to 'library/std/src/sys/sync')
-rw-r--r--library/std/src/sys/sync/condvar/no_threads.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/std/src/sys/sync/condvar/no_threads.rs b/library/std/src/sys/sync/condvar/no_threads.rs
index 88ce39305e1..18d97d4b17a 100644
--- a/library/std/src/sys/sync/condvar/no_threads.rs
+++ b/library/std/src/sys/sync/condvar/no_threads.rs
@@ -1,4 +1,5 @@
 use crate::sys::sync::Mutex;
+use crate::thread::sleep;
 use crate::time::Duration;
 
 pub struct Condvar {}
@@ -19,7 +20,8 @@ impl Condvar {
         panic!("condvar wait not supported")
     }
 
-    pub unsafe fn wait_timeout(&self, _mutex: &Mutex, _dur: Duration) -> bool {
-        panic!("condvar wait not supported");
+    pub unsafe fn wait_timeout(&self, _mutex: &Mutex, dur: Duration) -> bool {
+        sleep(dur);
+        false
     }
 }