pub struct RawThreadCounter { /* private fields */ }
Expand description
The internal implementation of the thread counter.
This struct handles the actual counting and synchronization mechanisms.
Implementations§
Source§impl RawThreadCounter
impl RawThreadCounter
Sourcepub fn increment(&self)
pub fn increment(&self)
Increments the thread counter.
§Note
It’s preferable to use ThreadCounter::ticket()
instead, which
ensures that the count is automatically decremented when the ticket is
dropped.
Sourcepub fn decrement(&self)
pub fn decrement(&self)
Decrements the thread counter.
If the count reaches zero, it notifies all waiting threads.
§Note
It’s preferable to use ThreadCounter::ticket()
instead, which
ensures that the count is automatically decremented when the ticket is
dropped.
Trait Implementations§
Source§impl AsRef<RawThreadCounter> for ThreadCounter
impl AsRef<RawThreadCounter> for ThreadCounter
Source§fn as_ref(&self) -> &RawThreadCounter
fn as_ref(&self) -> &RawThreadCounter
Converts this type into a shared reference of the (usually inferred) input type.
Auto Trait Implementations§
impl !Freeze for RawThreadCounter
impl !RefUnwindSafe for RawThreadCounter
impl Send for RawThreadCounter
impl Sync for RawThreadCounter
impl Unpin for RawThreadCounter
impl UnwindSafe for RawThreadCounter
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