Trait lock_api::RawRwLock [−][src]
pub unsafe trait RawRwLock { type GuardMarker; const INIT: Self; 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 { ... } }
Basic operations for a reader-writer lock.
Types implementing this trait can be used by RwLock
to form a safe and
fully-functioning RwLock
type.
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.
Associated Types
type GuardMarker
[src]
Marker type which determines whether a lock guard should be Send
. Use
one of the GuardSend
or GuardNoSend
helper types here.
Associated Constants
Loading content...Required methods
fn lock_shared(&self)
[src]
Acquires a shared lock, blocking the current thread until it is able to do so.
fn try_lock_shared(&self) -> bool
[src]
Attempts to acquire a shared lock without blocking.
unsafe fn unlock_shared(&self)
[src]
Releases a shared lock.
Safety
This method may only be called if a shared lock is held in the current context.
fn lock_exclusive(&self)
[src]
Acquires an exclusive lock, blocking the current thread until it is able to do so.
fn try_lock_exclusive(&self) -> bool
[src]
Attempts to acquire an exclusive lock without blocking.
unsafe fn unlock_exclusive(&self)
[src]
Releases an exclusive lock.
Safety
This method may only be called if an exclusive lock is held in the current context.