mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
sync: document FIFO behavior of tokio::sync::Mutex (#6279)
Signed-off-by: azuredream <[email protected]>
This commit is contained in:
@@ -17,6 +17,10 @@ use std::{fmt, mem, ptr};
|
||||
/// differences: [`lock`] is an async method so does not block, and the lock
|
||||
/// guard is designed to be held across `.await` points.
|
||||
///
|
||||
/// Tokio's Mutex operates on a guaranteed FIFO basis.
|
||||
/// This means that the order in which tasks call the [`lock`] method is
|
||||
/// the exact order in which they will acquire the lock.
|
||||
///
|
||||
/// # Which kind of mutex should you use?
|
||||
///
|
||||
/// Contrary to popular belief, it is ok and often preferred to use the ordinary
|
||||
|
||||
Reference in New Issue
Block a user