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
Source§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes