Struct style::shared_lock::SharedRwLock
[−]
[src]
pub struct SharedRwLock { /* fields omitted */ }
A shared read/write lock that can protect multiple objects.
In Gecko builds, we don't need the blocking behavior, just the safety. As such we implement this with an AtomicRefCell instead in Gecko builds, which is ~2x as fast, and panics (rather than deadlocking) when things go wrong (which is much easier to debug on CI).
Servo needs the blocking behavior for its unsynchronized animation setup, but that may not be web-compatible and may need to be changed (at which point Servo could use AtomicRefCell too).
Methods
impl SharedRwLock
[src]
pub fn new() -> Self
[src]
Create a new shared lock (servo).
pub fn wrap<T>(&self, data: T) -> Locked<T>
[src]
Wrap the given data to make its access protected by this lock.
pub fn read(&self) -> SharedRwLockReadGuard
[src]
Obtain the lock for reading (servo).
pub fn write(&self) -> SharedRwLockWriteGuard
[src]
Obtain the lock for writing (servo).
Trait Implementations
impl Clone for SharedRwLock
[src]
fn clone(&self) -> SharedRwLock
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl MallocSizeOf for SharedRwLock
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more