Struct widerwlock::WideRwLock

source ·
pub struct WideRwLock<T: ?Sized> { /* private fields */ }
Expand description

A multi-reader, single writer lock.

The implementation has the following properties:

  • Non-reentrant. Do no attempt to take this lock multiple times in the same thread. It will deadlock.
  • Writer preferenced: writers will get preference and hold back incoming readers when waiting.
  • 8x partitioned: allows very fast multi-reader locking.
  • Uncontended single threaded performance better than std::sync::Mutex and std::sync:RwLock
  • No poisoning. It should be possible to wrap this lock with poison support if needed.

This struct uses a single pointer to point into a 576 byte (64-byte aligned) heap area

Implementations

creates a new lock

Obtain a read lock. Multiple simultaneous read locks will be given if there are no writers waiting. The lock remains locked until the returned RAII guard is dropped.

Obtain a write lock. If a writer is waiting, no more read locks will be given until the writer has been granted access and finished. The lock remains locked until the returned RAII guard is dropped.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.