Trait cryo::Lock [−][src]
pub unsafe trait Lock { type LockMarker; type UnlockMarker; fn new() -> Self; unsafe fn lock_shared(&self); unsafe fn try_lock_shared(&self) -> bool; unsafe fn unlock_shared(&self); unsafe fn lock_exclusive(&self); unsafe fn try_lock_exclusive(&self) -> bool; unsafe fn unlock_exclusive(&self); }
A trait for readers-writer locks.
Associated Types
type LockMarker
[src]
The Send
-ness of this type indicates whether a lock can only be
acquired by the same thread as self
’s creator.
type UnlockMarker
[src]
The Send
-ness of this type indicates whether a lock can only be
released by the same thread as the one that acquired it.
Required methods
fn new() -> Self
[src]
unsafe fn lock_shared(&self)
[src]
Acquire a shared lock, blocking the current thread until the lock is acquired.
Safety
If Self::LockMarker
is !
Send
, the current thread must be the
same one as self
’s creator.
unsafe fn try_lock_shared(&self) -> bool
[src]
Acquire a shared lock.
Safety
If Self::LockMarker
is !
Send
, the current thread must be the
same one as self
’s creator.
unsafe fn unlock_shared(&self)
[src]
Release a shared lock.
Safety
There must be a shared lock to release.
If Self::UnlockMarker
is !
Send
, the current thread must own a
shared lock on self
.
unsafe fn lock_exclusive(&self)
[src]
Acquire an exclusive lock, blocking the current thread until the lock is acquired.
Safety
If Self::LockMarker
is !
Send
, the current thread must be the
same one as self
’s creator.
unsafe fn try_lock_exclusive(&self) -> bool
[src]
Acquire an exclusive lock.
Safety
If Self::LockMarker
is !
Send
, the current thread must be the
same one as self
’s creator.
unsafe fn unlock_exclusive(&self)
[src]
Release an exclusive lock.
Safety
There must be an exclusive lock to release.
If Self::UnlockMarker
is !
Send
, the current thread must own an
exclusive lock on self
.
Implementors
impl Lock for AtomicLock
[src]
impl Lock for AtomicLock
[src]atomic
only.type LockMarker = SendMarker
type UnlockMarker = SendMarker
fn new() -> Self
[src]
unsafe fn lock_shared(&self)
[src]
unsafe fn try_lock_shared(&self) -> bool
[src]
unsafe fn unlock_shared(&self)
[src]
unsafe fn lock_exclusive(&self)
[src]
unsafe fn try_lock_exclusive(&self) -> bool
[src]
unsafe fn unlock_exclusive(&self)
[src]
impl Lock for LocalLock
[src]
impl Lock for LocalLock
[src]fn new() -> Self
[src]
type LockMarker = NoSendMarker
type UnlockMarker = NoSendMarker
unsafe fn lock_shared(&self)
[src]
unsafe fn try_lock_shared(&self) -> bool
[src]
unsafe fn unlock_shared(&self)
[src]
unsafe fn lock_exclusive(&self)
[src]
unsafe fn try_lock_exclusive(&self) -> bool
[src]
unsafe fn unlock_exclusive(&self)
[src]
impl Lock for SyncLock
[src]
impl Lock for SyncLock
[src]std
only.type LockMarker = NoSendMarker
type UnlockMarker = SendMarker
fn new() -> Self
[src]
unsafe fn lock_shared(&self)
[src]
unsafe fn try_lock_shared(&self) -> bool
[src]
unsafe fn unlock_shared(&self)
[src]
unsafe fn lock_exclusive(&self)
[src]
unsafe fn try_lock_exclusive(&self) -> bool
[src]
unsafe fn unlock_exclusive(&self)
[src]
impl<T: RawRwLock> Lock for T
[src]
impl<T: RawRwLock> Lock for T
[src]lock_api
only.This crate’s LockTrait
is automatically implemented for types implementing
lock_api::RawRwLock