Skip to main content

RawRwLockUpgradeTimed

Trait RawRwLockUpgradeTimed 

Source
pub unsafe trait RawRwLockUpgradeTimed: RawRwLockUpgrade + RawRwLockTimed {
    // Required methods
    fn try_lock_upgradable_for(
        &self,
        timeout: Self::Duration,
    ) -> Option<Self::UpgradableGuard>;
    fn try_lock_upgradable_until(
        &self,
        timeout: Self::Instant,
    ) -> Option<Self::UpgradableGuard>;
    unsafe fn try_upgrade_for(
        &self,
        guard: Self::UpgradableGuard,
        timeout: Self::Duration,
    ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>;
    unsafe fn try_upgrade_until(
        &self,
        guard: Self::UpgradableGuard,
        timeout: Self::Instant,
    ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>;
}
Expand description

Additional methods for RwLocks which support upgradable locks and locking with timeouts.

§Safety

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

Required Methods§

Source

fn try_lock_upgradable_for( &self, timeout: Self::Duration, ) -> Option<Self::UpgradableGuard>

Attempts to acquire an upgradable lock until a timeout is reached.

See RawRwLockTimed::try_lock_shared_for for timeout behavior.

Source

fn try_lock_upgradable_until( &self, timeout: Self::Instant, ) -> Option<Self::UpgradableGuard>

Attempts to acquire an upgradable lock until a timeout is reached.

See RawRwLockTimed::try_lock_shared_until for timeout behavior.

Source

unsafe fn try_upgrade_for( &self, guard: Self::UpgradableGuard, timeout: Self::Duration, ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>

Attempts to upgrade an upgradable lock to an exclusive lock until a timeout is reached.

See RawRwLockTimed::try_lock_exclusive_for for timeout behavior.

On success, returns Ok with the exclusive state. On failure, the upgradable lock remains held and its state is returned in Err.

§Safety

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

Source

unsafe fn try_upgrade_until( &self, guard: Self::UpgradableGuard, timeout: Self::Instant, ) -> Result<Self::ExclusiveGuard, Self::UpgradableGuard>

Attempts to upgrade an upgradable lock to an exclusive lock until a timeout is reached.

See RawRwLockTimed::try_lock_exclusive_until for timeout behavior.

On success, returns Ok with the exclusive state. On failure, the upgradable lock remains held and its state is returned in Err.

§Safety

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

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§