Closed
Description
Feature gate: #![feature(mutex_unlock)]
This is a tracking issue for the Mutex::unlock
function. The goal of this function is to replace drop(mutex_guard)
which doesn't clear express that a synchronization event is occurring.
Some earlier discussion, including a previous implementation: #79434 (comment)
Public API
// std::sync::Mutex
impl<T> Mutex<T> {
/// Immediately drops the guard, unlocking the mutex.
///
/// This is equivalent to `drop(guard)`, but it is more self-documenting.
pub fn unlock(guard: MutexGuard<T>) {
drop(guard);
}
}
Steps / History
- Implementation: Add Mutex::unlock #81873
- Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
- Should an analogous function be added to
RwLock
? It would be a bit more complicated.