Struct kaspa_utils::sync::rwlock::RfRwLock
source · pub struct RfRwLock { /* private fields */ }Expand description
Readers-first Reader-writer Lock. If the lock is acquired by readers, then additional readers will always be able to acquire the lock as well even if a writer is already in the queue. Note that this makes it safe to make recursive read calls.
We currently only use this lock over an empty tuple, however it can easily contain data by
using UnsafeCell<T> and passing it to the various guards with or without mutable access
Implementations§
source§impl RfRwLock
impl RfRwLock
pub fn new() -> Self
pub async fn read(&self) -> RfRwLockReadGuard<'_>
pub fn blocking_read(&self) -> RfRwLockReadGuard<'_>
pub async fn read_owned(self: Arc<Self>) -> RfRwLockOwnedReadGuard
pub async fn write(&self) -> RfRwLockWriteGuard<'_>
pub fn blocking_write(&self) -> RfRwLockWriteGuard<'_>
pub async fn write_owned(self: Arc<Self>) -> RfRwLockOwnedWriteGuard
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for RfRwLock
impl Send for RfRwLock
impl Sync for RfRwLock
impl Unpin for RfRwLock
impl UnwindSafe for RfRwLock
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more