Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent wording for mutex types #3996

Closed
jwakely opened this issue May 12, 2020 · 2 comments · Fixed by #4013
Closed

Inconsistent wording for mutex types #3996

jwakely opened this issue May 12, 2020 · 2 comments · Fixed by #4013
Assignees

Comments

@jwakely
Copy link
Member

jwakely commented May 12, 2020

In Clause [thread] we have:

  • Returns: true if the lock was acquired, false otherwise.
  • Returns: true if the lock was acquired, false otherwise.
  • Returns: true if the lock was acquired, false otherwise.
  • Returns: true if ownership of the mutex was obtained for the calling thread, otherwise false.
  • Returns: true if ownership was obtained, otherwise false.
  • Returns: true if ownership was obtained, otherwise false.
  • Returns: true if the shared ownership lock was acquired, false otherwise.
  • Returns: true if the shared lock was acquired, false otherwise.
  • Returns: true if the shared lock was acquired, false otherwise.

I don't see any reason why:

  • We use "lock was acquired" in some places and "ownership was obtained" in others.
  • We say "false otherwise" sometimes and "otherwise false".
  • In eight places we say "ownership" but then in one place we say "ownership of the mutex".
  • In two places we say "shared lock" but in one place we say "shared ownership lock".
@CaseyCarter
Copy link
Contributor

We use "lock was acquired" in some places and "ownership was obtained" in others.

"ownership" makes sense for e.g. std::mutex which must be unlocked by the same thread that locked. We refer to the thread that successfully locked the mutex as its "owner" until it unlocks. (FWIW, I'd prefer "if the calling thread took ownership" to the passive voice "if ownership was obtained.") "ownership" notably does not fit more general Lockables for which unlockers need not necessarily hold the mutex.

That said, I don't see any reason why we couldn't use "lock was acquired" in all cases.

@jwakely
Copy link
Member Author

jwakely commented May 12, 2020

If some of the differences are there for good reasons that's fine, but with the other inconsistencies it's hard to tell what's intentional and significant, and what's just noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants