diff --git a/runtime/src/waitable_condvar.rs b/runtime/src/waitable_condvar.rs index 92fc68c2f..ba5575a13 100644 --- a/runtime/src/waitable_condvar.rs +++ b/runtime/src/waitable_condvar.rs @@ -12,12 +12,16 @@ pub struct WaitableCondvar { } impl WaitableCondvar { + /// wake up all threads waiting on this event pub fn notify_all(&self) { self.event.notify_all(); } + /// wake up one thread waiting on this event pub fn notify_one(&self) { self.event.notify_one(); } + /// wait on the event + /// return true if timed out, false if event triggered pub fn wait_timeout(&self, timeout: Duration) -> bool { let lock = self.mutex.lock().unwrap(); let res = self.event.wait_timeout(lock, timeout).unwrap();