Skip to content

Fix RwLock::try_write documentation for WouldBlock condition #142967

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

krikera
Copy link
Contributor

@krikera krikera commented Jun 24, 2025

Fix RwLock::try_write documentation for WouldBlock condition

The documentation incorrectly stated that try_write only fails when
'already locked exclusively', but it actually fails when there are
either shared (read) or exclusive (write) locks.

Fixes #142852

@rustbot
Copy link
Collaborator

rustbot commented Jun 24, 2025

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 24, 2025
@rustbot

This comment has been minimized.

The documentation incorrectly stated that try_write only fails when
'already locked exclusively', but it actually fails when there are
either shared (read) or exclusive (write) locks.
@krikera krikera force-pushed the fix-rwlock-try-write-docs branch from 89ea835 to bd76559 Compare June 24, 2025 15:12
@jhpratt
Copy link
Member

jhpratt commented Jun 25, 2025

I'd prefer simply removing the word "exclusively", keeping the explanation as simple as possible.

@jhpratt jhpratt added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RwLock::try_write should say that it fails with WouldBlock if there's a shared lock
3 participants