1 use crate::sys::mutex::Mutex;
2 use crate::time::Duration;
4 use super::waitqueue::{WaitVariable, WaitQueue, SpinMutex};
7 inner: SpinMutex<WaitVariable<()>>,
11 pub const fn new() -> Condvar {
12 Condvar { inner: SpinMutex::new(WaitVariable::new(())) }
16 pub unsafe fn init(&mut self) {}
19 pub unsafe fn notify_one(&self) {
20 let _ = WaitQueue::notify_one(self.inner.lock());
24 pub unsafe fn notify_all(&self) {
25 let _ = WaitQueue::notify_all(self.inner.lock());
28 pub unsafe fn wait(&self, mutex: &Mutex) {
29 let guard = self.inner.lock();
31 WaitQueue::wait(guard);
35 pub unsafe fn wait_timeout(&self, _mutex: &Mutex, _dur: Duration) -> bool {
36 panic!("timeout not supported in SGX");
40 pub unsafe fn destroy(&self) {}