mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
sync: document FIFO behavior of tokio::sync::Mutex
(#6279)
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
This commit is contained in:
parent
84c5674c60
commit
8463af92af
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user