Skip to content

Inconsistency in the document of std::sync::Mutex #40176

Closed
@topecongiro

Description

@topecongiro

In the document of std::sync::Mutex, lock and mutex are used interchangeably.
For example, the document of lock() is as follows:

/// This function will block the local thread until it is available to acquire
/// the mutex. Upon returning, the thread is the only thread with the mutex
/// held. An RAII guard is returned to allow scoped unlock of the lock. When
/// the guard goes out of scope, the mutex will be unlocked.

Here, the lock and the mutex are used to refer to the same Mutex object. As a non-native English speaker, this kind of inconsistency is somewhat confusing. This is especially the case for this document because lock also refers to the operation on the mutex object.

I do understand these two words are interchangable unless you are writing a thesis or the like. However, I feel that using them consistently throughout the document makes it more readable.

Therefore, I would like to suggest to use mutex to refer to the Mutex object, and lock or unlock to refer to the operations on the Mutex object.

e.g. An RAII guard is returned to allow scoped unlock of the mutex.

Sorry in advance if this inconsistency is intentional.

Metadata

Metadata

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsP-highHigh priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions