pub struct SemaphoreState { /* private fields */ }Expand description
Shared admission-control counter backing SEMAPHORE words. Clones
share the backend, so every word naming one semaphore observes the
same count. Lock-free atomics throughout: no mutex exists to poison,
so Drop paths stay infallible on every path including unwinding.
No waiter ever sleeps on the counter, so the non-blocking acquire
adds zero wedge surface.
Implementations§
Source§impl SemaphoreState
impl SemaphoreState
Sourcepub fn try_acquire(&self) -> bool
pub fn try_acquire(&self) -> bool
Non-blocking acquire: true and counted when a permit was free. Compare-and-swap loop, so only a winning CAS claims a slot.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SemaphoreState
impl RefUnwindSafe for SemaphoreState
impl Send for SemaphoreState
impl Sync for SemaphoreState
impl Unpin for SemaphoreState
impl UnsafeUnpin for SemaphoreState
impl UnwindSafe for SemaphoreState
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