Struct rayon_core::latch::SpinLatch
source · pub(crate) struct SpinLatch<'r> {
core_latch: CoreLatch,
registry: &'r Arc<Registry>,
target_worker_index: usize,
cross: bool,
}
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§
§core_latch: CoreLatch
§registry: &'r Arc<Registry>
§target_worker_index: usize
§cross: bool
Implementations§
source§impl<'r> SpinLatch<'r>
impl<'r> SpinLatch<'r>
sourcepub(crate) fn new(thread: &'r WorkerThread) -> SpinLatch<'r>
pub(crate) fn new(thread: &'r WorkerThread) -> SpinLatch<'r>
Creates a new spin latch that is owned by thread
. This means
that thread
is the only thread that should be blocking on
this latch – it also means that when the latch is set, we
will wake thread
if it is sleeping.
sourcepub(crate) fn cross(thread: &'r WorkerThread) -> SpinLatch<'r>
pub(crate) fn cross(thread: &'r WorkerThread) -> SpinLatch<'r>
Creates a new spin latch for cross-threadpool blocking. Notably, we need to make sure the registry is kept alive after setting, so we can safely call the notification.
pub(crate) fn probe(&self) -> bool
Trait Implementations§
source§impl<'r> AsCoreLatch for SpinLatch<'r>
impl<'r> AsCoreLatch for SpinLatch<'r>
fn as_core_latch(&self) -> &CoreLatch
Auto Trait Implementations§
impl<'r> !Freeze for SpinLatch<'r>
impl<'r> !RefUnwindSafe for SpinLatch<'r>
impl<'r> Send for SpinLatch<'r>
impl<'r> Sync for SpinLatch<'r>
impl<'r> Unpin for SpinLatch<'r>
impl<'r> !UnwindSafe for SpinLatch<'r>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more