Closed
Description
Some implementations of RwLock implement a downgrading primitive that makes it possible to atomically release a write and enter a read, without letting any other writer grab the lock in the meantime.
This is sometimes very useful, so I'd like some such feature for RwLock.
For instance:
struct RwLockWriteGuard<'a, T> {
// ...
}
/// Drop the write lock in favor of a read lock, atomically.
///
/// Returns an error if, for some reason, the lock cannot be reacquired, in which case the lock is only dropped.
fn downgrade(self) -> LockResult<RwLockReadGuard<'a, T>> {
// ...
}