lock_api

Trait RawRwLockUpgrade

Source
pub unsafe trait RawRwLockUpgrade: RawRwLock {
    // Required methods
    fn lock_upgradable(&self);
    fn try_lock_upgradable(&self) -> bool;
    unsafe fn unlock_upgradable(&self);
    unsafe fn upgrade(&self);
    unsafe fn try_upgrade(&self) -> bool;
}
Expand description

Additional methods for RwLocks which support atomically upgrading a shared lock to an exclusive lock.

This requires acquiring a special “upgradable read lock” instead of a normal shared lock. There may only be one upgradable lock at any time, otherwise deadlocks could occur when upgrading.

Required Methods§

Source

fn lock_upgradable(&self)

Acquires an upgradable lock, blocking the current thread until it is able to do so.

Source

fn try_lock_upgradable(&self) -> bool

Attempts to acquire an upgradable lock without blocking.

Source

unsafe fn unlock_upgradable(&self)

Releases an upgradable lock.

§Safety

This method may only be called if an upgradable lock is held in the current context.

Source

unsafe fn upgrade(&self)

Upgrades an upgradable lock to an exclusive lock.

§Safety

This method may only be called if an upgradable lock is held in the current context.

Source

unsafe fn try_upgrade(&self) -> bool

Attempts to upgrade an upgradable lock to an exclusive lock without blocking.

§Safety

This method may only be called if an upgradable lock is held in the current context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§