Bypass the lock in get_property_value.

MozReview-Commit-ID: ECkLn5TPBDO
This commit is contained in:
Bobby Holley 2017-09-05 15:19:50 -07:00
parent 21c9ef3c6d
commit 48c95cdb6d
2 changed files with 29 additions and 3 deletions

View file

@ -176,6 +176,13 @@ impl<T> Locked<T> {
}
}
/// Access the data for reading without verifying the lock. Use with caution.
#[cfg(feature = "gecko")]
pub unsafe fn read_unchecked<'a>(&'a self) -> &'a T {
let ptr = self.data.get();
&*ptr
}
/// Access the data for writing.
pub fn write_with<'a>(&'a self, guard: &'a mut SharedRwLockWriteGuard) -> &'a mut T {
assert!(self.same_lock_as(&guard.0),