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

sync: Add RwLock::{try_read, try_write} #2548

Closed
wants to merge 3 commits into from

Conversation

pingw33n
Copy link

Closes #2284

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-sync Module: tokio/sync labels May 20, 2020
@Darksonn Darksonn requested a review from hawkw May 20, 2020 19:44
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 thanks!

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm — thanks for adding loom tests!

n.b. that this change will conflict with #2445, which removes the ReleasingPermit type — whichever PR merges second will need to be rebased and updated. I think this branch should probably merge first.

tokio/src/sync/tests/loom_rwlock.rs Outdated Show resolved Hide resolved
tokio/src/sync/tests/loom_rwlock.rs Outdated Show resolved Hide resolved
tokio/src/sync/tests/loom_rwlock.rs Outdated Show resolved Hide resolved
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
@carllerche
Copy link
Member

Looks like master needs to be merged.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@Darksonn
Copy link
Contributor

I merged master, and it broke with the following message:

error[E0308]: mismatched types
   --> tokio/src/sync/rwlock.rs:127:28
    |
127 |         lock.s.try_acquire(num_permits)?;
    |                            ^^^^^^^^^^^
    |                            |
    |                            expected `u32`, found `u16`
    |                            help: you can convert an `u16` to `u32`: `num_permits.into()`

@carllerche
Copy link
Member

Closing due to inactivity. A new PR can be opened tracking master.

@carllerche carllerche closed this Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-sync Module: tokio/sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RwLock miss try_read and try_write method
4 participants