-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Wikipedia link to write-preferring in RwLock documentation is inconsistent with Tokio's definition #6901
Comments
This issue tracker is intended for bug reports and feature requests. The question seems unclear, But the
Both versions of the documentation are correct, it just different variant of the lock, Some implementations offer fairness, some don't. |
I don't have a question. I think Tokio's documentation is confusing. The documentation of Tokio's I think the documentations is clearer when the link to Wikipedia is removed.
Are you talking about Readers-Writer locks in general? Or is there a way in Tokio to switch priority policies? |
Tokio's rwlock is using a write-preferring fairness policy. Whenever a writer tries to acquire the lock, it's guaranteed to get it eventually. This happens at the expense of readers, since a reader may fail to acquire the lock despite the lock being in use by other readers. |
I agree that If users click the link in Tokio's documentation, believing that it is appropriate for |
In my opinion, it makes more sense to update the wikipedia article than to remove the link from Tokio's docs. |
The RwLock documentation links to this Wikipedia section: https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Priority_policies.
Which says:
However, the Tokio documentation says:
If I am not mistaken, the difference is that Wikipedia says that if there is a writer anywhere in the queue no new readers can acquire the lock, while the Tokio documentation seems to say that only when the writer is at the head of the queue no new readers can acquire the lock.
The text was updated successfully, but these errors were encountered: