Struct maitake::sync::semaphore::OwnedPermit
pub struct OwnedPermit<Lock = Spinlock>where
Lock: RawMutex,{ /* private fields */ }
Available on crate feature
alloc
only.Expand description
An owned RAII guard representing one or more permits acquired from a
Semaphore
.
When the OwnedPermit
is dropped, the permits it represents are
released back to the Semaphore
, potentially waking another task.
This type is identical to the Permit
type, except that it holds an
Arc
clone of the Semaphore
, rather than borrowing it. This
allows the guard to be valid for the 'static
lifetime.
This type is returned by the Semaphore::acquire_owned
and
Semaphore::try_acquire_owned
methods.
Implementations§
§impl<Lock> OwnedPermit<Lock>where
Lock: RawMutex,
impl<Lock> OwnedPermit<Lock>where
Lock: RawMutex,
pub fn forget(self)
pub fn forget(self)
Forget this permit, dropping it without returning the number of acquired permits to the semaphore.
This permanently decreases the number of permits in the semaphore by
self.permits()
.
Trait Implementations§
§impl<Lock> Debug for OwnedPermit<Lock>
impl<Lock> Debug for OwnedPermit<Lock>
Auto Trait Implementations§
impl<Lock = Spinlock> !RefUnwindSafe for OwnedPermit<Lock>
impl<Lock> Send for OwnedPermit<Lock>
impl<Lock> Sync for OwnedPermit<Lock>
impl<Lock> Unpin for OwnedPermit<Lock>
impl<Lock = Spinlock> !UnwindSafe for OwnedPermit<Lock>
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