Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into unlock_unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Bächler committed Jun 17, 2020
2 parents 30d4375 + 1f6e68e commit 214cdb0
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions lock_api/src/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,33 +1692,6 @@ impl<'a, R: RawRwLock + 'a, T: ?Sized + 'a> MappedRwLockWriteGuard<'a, R, T> {
}
}

impl<'a, R: RawRwLockDowngrade + 'a, T: ?Sized + 'a> MappedRwLockWriteGuard<'a, R, T> {
/// Atomically downgrades a write lock into a read lock without allowing any
/// writers to take exclusive access of the lock in the meantime.
///
/// Note that if there are any writers currently waiting to take the lock
/// then other readers may not be able to acquire the lock even if it was
/// downgraded.
#[deprecated(
since = "0.3.3",
note = "This function is unsound and will be removed in the future, see issue #198"
)]
pub fn downgrade(s: Self) -> MappedRwLockReadGuard<'a, R, T> {
// Safety: A MappedRwLockWriteGuard always holds an exclusive lock.
unsafe {
s.raw.downgrade();
}
let raw = s.raw;
let data = s.data;
mem::forget(s);
MappedRwLockReadGuard {
raw,
data,
marker: PhantomData,
}
}
}

impl<'a, R: RawRwLockFair + 'a, T: ?Sized + 'a> MappedRwLockWriteGuard<'a, R, T> {
/// Unlocks the `RwLock` using a fair unlock protocol.
///
Expand Down

0 comments on commit 214cdb0

Please sign in to comment.