-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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>> {
// ...
}Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.