Skip to content

Commit 0e0babc

Browse files
committed
docs(fs): Clarify that File::lock coordinates across processes
1 parent 595f14b commit 0e0babc

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

library/std/src/fs.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,8 @@ impl File {
815815

816816
/// Acquire an exclusive lock on the file. Blocks until the lock can be acquired.
817817
///
818-
/// This acquires an exclusive lock; no other file handle to this file may acquire another lock.
818+
/// This acquires an exclusive lock; no other file handle to this file, in this or any other
819+
/// process, may acquire another lock.
819820
///
820821
/// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
821822
/// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
@@ -868,8 +869,8 @@ impl File {
868869

869870
/// Acquire a shared (non-exclusive) lock on the file. Blocks until the lock can be acquired.
870871
///
871-
/// This acquires a shared lock; more than one file handle may hold a shared lock, but none may
872-
/// hold an exclusive lock at the same time.
872+
/// This acquires a shared lock; more than one file handle, in this or any other process, may
873+
/// hold a shared lock, but none may hold an exclusive lock at the same time.
873874
///
874875
/// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
875876
/// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
@@ -923,7 +924,8 @@ impl File {
923924
/// Returns `Err(TryLockError::WouldBlock)` if a different lock is already held on this file
924925
/// (via another handle/descriptor).
925926
///
926-
/// This acquires an exclusive lock; no other file handle to this file may acquire another lock.
927+
/// This acquires an exclusive lock; no other file handle to this file, in this or any other
928+
/// process, may acquire another lock.
927929
///
928930
/// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
929931
/// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with
@@ -987,8 +989,8 @@ impl File {
987989
/// Returns `Err(TryLockError::WouldBlock)` if a different lock is already held on this file
988990
/// (via another handle/descriptor).
989991
///
990-
/// This acquires a shared lock; more than one file handle may hold a shared lock, but none may
991-
/// hold an exclusive lock at the same time.
992+
/// This acquires a shared lock; more than one file handle, in this or any other process, may
993+
/// hold a shared lock, but none may hold an exclusive lock at the same time.
992994
///
993995
/// This lock may be advisory or mandatory. This lock is meant to interact with [`lock`],
994996
/// [`try_lock`], [`lock_shared`], [`try_lock_shared`], and [`unlock`]. Its interactions with

0 commit comments

Comments
 (0)