mirror of
https://github.com/rust-lang/rust
synced 2024-09-15 22:50:55 +00:00
27 lines
555 B
Rust
27 lines
555 B
Rust
//@ build-pass (FIXME(62277): could be check-pass?)
|
|
|
|
use std::cell::UnsafeCell;
|
|
use std::sync::atomic::AtomicU32;
|
|
pub struct Condvar {
|
|
condvar: UnsafeCell<AtomicU32>,
|
|
}
|
|
|
|
unsafe impl Send for Condvar {}
|
|
unsafe impl Sync for Condvar {}
|
|
|
|
#[repr(C)]
|
|
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
|
|
struct NoWait(u32);
|
|
|
|
const CONDVAR_HAS_NO_WAITERS: NoWait = NoWait(42);
|
|
|
|
impl Condvar {
|
|
pub const fn new() -> Condvar {
|
|
Condvar {
|
|
condvar: UnsafeCell::new(AtomicU32::new(CONDVAR_HAS_NO_WAITERS.0)),
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {}
|