pub unsafe trait RawRwLock {
    type GuardMarker;

    // Required methods
    fn lock_shared(&self);
    fn try_lock_shared(&self) -> bool;
    unsafe fn unlock_shared(&self);
    fn lock_exclusive(&self);
    fn try_lock_exclusive(&self) -> bool;
    unsafe fn unlock_exclusive(&self);
    fn is_locked(&self) -> bool;
    fn is_locked_exclusive(&self) -> bool;
}
Expand description

Trait abstracting over blocking RwLock implementations (maitake-sync’s version).

Safety

Implementations of this trait must ensure that the RwLock is actually exclusive: an exclusive lock can’t be acquired while an exclusive or shared lock exists, and a shared lock can’t be acquire while an exclusive lock exists.

Required Associated Types§

source

type GuardMarker

Marker type which determines whether a lock guard should be Send.

Required Methods§

source

fn lock_shared(&self)

Acquires a shared lock, blocking the current thread/CPU core until it is able to do so.

source

fn try_lock_shared(&self) -> bool

Attempts to acquire a shared lock without blocking.

source

unsafe fn unlock_shared(&self)

Releases a shared lock.

Safety

This method may only be called if a shared lock is held in the current context.

source

fn lock_exclusive(&self)

Acquires an exclusive lock, blocking the current thread/CPU core until it is able to do so.

source

fn try_lock_exclusive(&self) -> bool

Attempts to acquire an exclusive lock without blocking.

source

unsafe fn unlock_exclusive(&self)

Releases an exclusive lock.

Safety

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

source

fn is_locked(&self) -> bool

Returns true if this RwLock is currently locked in any way.

source

fn is_locked_exclusive(&self) -> bool

Returns true if this RwLock is currently locked exclusively.

Implementors§