pub struct SharedRWLock { /* private fields */ }Implementations§
pub fn create(path: impl AsRef<Path>) -> Result<Self, RWLockError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, RWLockError>
Sourcepub fn try_read_lock(&self) -> Result<ReadGuard<'_>, RWLockError>
pub fn try_read_lock(&self) -> Result<ReadGuard<'_>, RWLockError>
Try to acquire a read lock without blocking.
Sourcepub fn read_lock(&self) -> ReadGuard<'_>
pub fn read_lock(&self) -> ReadGuard<'_>
Acquire a read lock, blocking with backoff until available. Writer-priority: blocks if any writer is active OR waiting.
Sourcepub fn try_write_lock(&self) -> Result<WriteGuard<'_>, RWLockError>
pub fn try_write_lock(&self) -> Result<WriteGuard<'_>, RWLockError>
Try to acquire a write lock without blocking.
Sourcepub fn write_lock(&self) -> WriteGuard<'_>
pub fn write_lock(&self) -> WriteGuard<'_>
Acquire a write lock, blocking until available. Registers as “waiting” so new readers will block.
Sourcepub fn reader_count(&self) -> u32
pub fn reader_count(&self) -> u32
Number of active readers (observational; may race).
Sourcepub fn has_writer(&self) -> bool
pub fn has_writer(&self) -> bool
True if a writer currently holds the lock.
Sourcepub fn waiting_writers(&self) -> u32
pub fn waiting_writers(&self) -> u32
Number of writers currently waiting for the lock.
Sourcepub fn release_read_for_blocking(&self)
pub fn release_read_for_blocking(&self)
Public hook for the BlockingRWLock wrapper to mirror the
inner ReadGuard::drop semantics after the wrapper’s own
guard runs (the wrapper mem::forgets the inner guard so it
can interleave a wake call between the state release and the
guard’s destructor).
Sourcepub fn release_write_for_blocking(&self)
pub fn release_write_for_blocking(&self)
Public hook for the BlockingRWLock wrapper; mirror of
WriteGuard::drop.