Skip to content

Commit

Permalink
sync: document FIFO behavior of tokio::sync::Mutex (#6279)
Browse files Browse the repository at this point in the history
Signed-off-by: azuredream <zhaozixuan67@gmail.com>
  • Loading branch information
azuredream authored Jan 11, 2024
1 parent 84c5674 commit 8463af9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tokio/src/sync/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8463af9

Please sign in to comment.