Struct rayon_core::latch::CoreLatch
source · pub(crate) struct CoreLatch {
state: AtomicUsize,
}
Expand description
Spin latches are the simplest, most efficient kind, but they do
not support a wait()
operation. They just have a boolean flag
that becomes true when set()
is called.
Fields§
§state: AtomicUsize
Implementations§
source§impl CoreLatch
impl CoreLatch
fn new() -> Self
sourcepub(crate) fn get_sleepy(&self) -> bool
pub(crate) fn get_sleepy(&self) -> bool
Invoked by owning thread as it prepares to sleep. Returns true if the owning thread may proceed to fall asleep, false if the latch was set in the meantime.
sourcepub(crate) fn fall_asleep(&self) -> bool
pub(crate) fn fall_asleep(&self) -> bool
Invoked by owning thread as it falls asleep sleep. Returns true if the owning thread should block, or false if the latch was set in the meantime.
sourcepub(crate) fn wake_up(&self)
pub(crate) fn wake_up(&self)
Invoked by owning thread as it falls asleep sleep. Returns true if the owning thread should block, or false if the latch was set in the meantime.
sourceunsafe fn set(this: *const Self) -> bool
unsafe fn set(this: *const Self) -> bool
Set the latch. If this returns true, the owning thread was sleeping and must be awoken.
This is private because, typically, setting a latch involves doing some wakeups; those are encapsulated in the surrounding latch code.