Skip to main content

RawRwLockUpgradeFair

Trait RawRwLockUpgradeFair 

Source
pub unsafe trait RawRwLockUpgradeFair: RawRwLockUpgrade + RawRwLockFair {
    // Required method
    unsafe fn unlock_upgradable_fair(&self, guard: Self::UpgradableGuard);

    // Provided method
    unsafe fn bump_upgradable(&self, guard: &mut Self::UpgradableGuard) { ... }
}
Expand description

Additional methods for RwLocks which support upgradable locks and fair unlocking.

§Safety

Implementations must uphold the safety requirements of RawRwLock for the additional methods provided by this trait.

Required Methods§

Source

unsafe fn unlock_upgradable_fair(&self, guard: Self::UpgradableGuard)

Releases an upgradable lock using a fair unlock protocol.

§Safety

This method requires the state for an upgradable acquisition of this lock held in the current context.

Provided Methods§

Source

unsafe fn bump_upgradable(&self, guard: &mut Self::UpgradableGuard)

Temporarily yields an upgradable lock to a waiting thread if there is one.

This method is functionally equivalent to calling unlock_upgradable_fair followed by lock_upgradable, however it can be much more efficient in the case where there are no waiting threads.

§Safety

This method requires the state for an upgradable acquisition of this lock held in the current context.

Implementations may unwind only with ownership in the original mode and valid guard state restored. If restoration fails, they must abort.

§Aborts

The default implementation aborts if re-locking the RwLock panics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§