blob: ff2046b0edcdfb9503841635cfd35a748b307331 [file]
use crate::sys::sync::Mutex;
use crate::thread::sleep;
use crate::time::Duration;
#[cfg(all(
target_has_threads,
// VEXos is only "target_has_threads" because it allows user interrupt handlers which preempt
// the main thread, but they are forbidden from accessing sync primitives (the same as UNIX
// signal handlers).
not(target_os = "vexos"),
// Trusty is "target_has_threads" because it needs atomics for shared-memory IPC, but processes
// can't spawn threads.
not(target_os = "trusty"),
))]
compile_error!("Using no_threads implementation on a target with threads");
pub struct Condvar {}
impl Condvar {
#[inline]
pub const fn new() -> Condvar {
Condvar {}
}
#[inline]
pub fn notify_one(&self) {}
#[inline]
pub fn notify_all(&self) {}
pub unsafe fn wait(&self, _mutex: &Mutex) {
panic!("condvar wait not supported")
}
pub unsafe fn wait_timeout(&self, _mutex: &Mutex, dur: Duration) -> bool {
sleep(dur);
false
}
}