pub struct RawRwLock<const RECURSIVE: bool = false> { /* private fields */ }Expand description
Raw reader-writer lock type backed by the parking lot.
If RECURSIVE is true, readers are prioritized over writers: acquiring a
read lock is guaranteed not to block unless a writer currently holds the
lock. This permits recursive read locking, but may starve writers.
Trait Implementations§
Source§impl<const RECURSIVE: bool> RawRwLock for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLock for RawRwLock<RECURSIVE>
Per-acquisition state stored in the lock guard. Read more
Source§type ExclusiveGuard = GuardNoSend
type ExclusiveGuard = GuardNoSend
Per-acquisition state for an exclusive lock. Read more
Source§fn lock_exclusive(&self) -> Self::ExclusiveGuard
fn lock_exclusive(&self) -> Self::ExclusiveGuard
Acquires an exclusive lock, blocking the current thread until it is able to do so.
Source§fn try_lock_exclusive(&self) -> Option<Self::ExclusiveGuard>
fn try_lock_exclusive(&self) -> Option<Self::ExclusiveGuard>
Attempts to acquire an exclusive lock without blocking.
Source§unsafe fn unlock_exclusive(&self, _guard: Self::ExclusiveGuard)
unsafe fn unlock_exclusive(&self, _guard: Self::ExclusiveGuard)
Releases an exclusive lock. Read more
Acquires a shared lock, blocking the current thread until it is able to do so.
Attempts to acquire a shared lock without blocking.
Releases a shared lock. Read more
Source§fn is_locked_exclusive(&self) -> bool
fn is_locked_exclusive(&self) -> bool
Check if this
RwLock is currently exclusively locked. Read moreSource§impl<const RECURSIVE: bool> RawRwLockDowngrade for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockDowngrade for RawRwLock<RECURSIVE>
Source§unsafe fn downgrade(&self, guard: Self::ExclusiveGuard) -> Self::SharedGuard
unsafe fn downgrade(&self, guard: Self::ExclusiveGuard) -> Self::SharedGuard
Atomically downgrades an exclusive lock into a shared lock without
allowing any thread to take an exclusive lock in the meantime. Read more
Source§impl<const RECURSIVE: bool> RawRwLockFair for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockFair for RawRwLock<RECURSIVE>
Releases a shared lock using a fair unlock protocol. Read more
Source§unsafe fn unlock_exclusive_fair(&self, _guard: Self::ExclusiveGuard)
unsafe fn unlock_exclusive_fair(&self, _guard: Self::ExclusiveGuard)
Releases an exclusive lock using a fair unlock protocol. Read more
Temporarily yields a shared lock to a waiting thread if there is one. Read more
Source§unsafe fn bump_exclusive(&self, _guard: &mut Self::ExclusiveGuard)
unsafe fn bump_exclusive(&self, _guard: &mut Self::ExclusiveGuard)
Temporarily yields an exclusive lock to a waiting thread if there is one. Read more
Source§impl<const RECURSIVE: bool> RawRwLockTimed for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockTimed for RawRwLock<RECURSIVE>
Attempts to acquire a shared lock until a timeout is reached. Read more
Attempts to acquire a shared lock until a timeout is reached. Read more
Source§fn try_lock_exclusive_for(
&self,
timeout: Duration,
) -> Option<Self::ExclusiveGuard>
fn try_lock_exclusive_for( &self, timeout: Duration, ) -> Option<Self::ExclusiveGuard>
Attempts to acquire an exclusive lock until a timeout is reached. Read more
Source§fn try_lock_exclusive_until(
&self,
timeout: Instant,
) -> Option<Self::ExclusiveGuard>
fn try_lock_exclusive_until( &self, timeout: Instant, ) -> Option<Self::ExclusiveGuard>
Attempts to acquire an exclusive lock until a timeout is reached. Read more
Source§impl<const RECURSIVE: bool> RawRwLockUpgrade for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockUpgrade for RawRwLock<RECURSIVE>
Source§type UpgradableGuard = GuardNoSend
type UpgradableGuard = GuardNoSend
Per-acquisition state for an upgradable read lock. Read more
Source§fn lock_upgradable(&self) -> Self::UpgradableGuard
fn lock_upgradable(&self) -> Self::UpgradableGuard
Acquires an upgradable lock, blocking the current thread until it is able to do so.
Source§fn try_lock_upgradable(&self) -> Option<Self::UpgradableGuard>
fn try_lock_upgradable(&self) -> Option<Self::UpgradableGuard>
Attempts to acquire an upgradable lock without blocking.
Source§unsafe fn unlock_upgradable(&self, _guard: Self::UpgradableGuard)
unsafe fn unlock_upgradable(&self, _guard: Self::UpgradableGuard)
Releases an upgradable lock. Read more
Source§unsafe fn upgrade(&self, guard: Self::UpgradableGuard) -> Self::ExclusiveGuard
unsafe fn upgrade(&self, guard: Self::UpgradableGuard) -> Self::ExclusiveGuard
Upgrades an upgradable lock to an exclusive lock. Read more
Source§unsafe fn try_upgrade(
&self,
guard: Self::UpgradableGuard,
) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>
unsafe fn try_upgrade( &self, guard: Self::UpgradableGuard, ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>
Attempts to upgrade an upgradable lock to an exclusive lock without
blocking. Read more
Source§impl<const RECURSIVE: bool> RawRwLockUpgradeDowngrade for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockUpgradeDowngrade for RawRwLock<RECURSIVE>
Source§unsafe fn downgrade_upgradable(
&self,
guard: Self::UpgradableGuard,
) -> Self::SharedGuard
unsafe fn downgrade_upgradable( &self, guard: Self::UpgradableGuard, ) -> Self::SharedGuard
Downgrades an upgradable lock to a shared lock. Read more
Source§unsafe fn downgrade_to_upgradable(
&self,
guard: Self::ExclusiveGuard,
) -> Self::UpgradableGuard
unsafe fn downgrade_to_upgradable( &self, guard: Self::ExclusiveGuard, ) -> Self::UpgradableGuard
Downgrades an exclusive lock to an upgradable lock. Read more
Source§impl<const RECURSIVE: bool> RawRwLockUpgradeFair for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockUpgradeFair for RawRwLock<RECURSIVE>
Source§unsafe fn unlock_upgradable_fair(&self, _guard: Self::UpgradableGuard)
unsafe fn unlock_upgradable_fair(&self, _guard: Self::UpgradableGuard)
Releases an upgradable lock using a fair unlock protocol. Read more
Source§unsafe fn bump_upgradable(&self, _guard: &mut Self::UpgradableGuard)
unsafe fn bump_upgradable(&self, _guard: &mut Self::UpgradableGuard)
Temporarily yields an upgradable lock to a waiting thread if there is one. Read more
Source§impl<const RECURSIVE: bool> RawRwLockUpgradeTimed for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RawRwLockUpgradeTimed for RawRwLock<RECURSIVE>
Source§fn try_lock_upgradable_until(
&self,
timeout: Instant,
) -> Option<Self::UpgradableGuard>
fn try_lock_upgradable_until( &self, timeout: Instant, ) -> Option<Self::UpgradableGuard>
Attempts to acquire an upgradable lock until a timeout is reached. Read more
Source§fn try_lock_upgradable_for(
&self,
timeout: Duration,
) -> Option<Self::UpgradableGuard>
fn try_lock_upgradable_for( &self, timeout: Duration, ) -> Option<Self::UpgradableGuard>
Attempts to acquire an upgradable lock until a timeout is reached. Read more
Source§unsafe fn try_upgrade_until(
&self,
guard: Self::UpgradableGuard,
timeout: Instant,
) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>
unsafe fn try_upgrade_until( &self, guard: Self::UpgradableGuard, timeout: Instant, ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>
Attempts to upgrade an upgradable lock to an exclusive lock until a
timeout is reached. Read more
Source§unsafe fn try_upgrade_for(
&self,
guard: Self::UpgradableGuard,
timeout: Duration,
) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>
unsafe fn try_upgrade_for( &self, guard: Self::UpgradableGuard, timeout: Duration, ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>
Attempts to upgrade an upgradable lock to an exclusive lock until a
timeout is reached. Read more
Auto Trait Implementations§
impl<const RECURSIVE: bool = false> !Freeze for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> RefUnwindSafe for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> Send for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> Sync for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> Unpin for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> UnsafeUnpin for RawRwLock<RECURSIVE>
impl<const RECURSIVE: bool> UnwindSafe for RawRwLock<RECURSIVE>
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