-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Implementation: #[feature(nonpoison_condvar)]
#144651
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
base: master
Are you sure you want to change the base?
Conversation
#[feature(nonpoison_condvar)]
…ark-Simulacrum Implementation: `#[feature(nonpoison_rwlock)]` Tracking Issue: rust-lang#134645 This PR continues the effort made in rust-lang#144022 by adding the implementation of `nonpoison::rwlock`. Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable. ### Related PRs - `nonpoison_condvar` implementation: rust-lang#144651 - `nonpoison_once` implementation: rust-lang#144653
…ark-Simulacrum Implementation: `#[feature(nonpoison_rwlock)]` Tracking Issue: rust-lang#134645 This PR continues the effort made in rust-lang#144022 by adding the implementation of `nonpoison::rwlock`. Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable. ### Related PRs - `nonpoison_condvar` implementation: rust-lang#144651 - `nonpoison_once` implementation: rust-lang#144653
Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-Simulacrum Implementation: `#[feature(nonpoison_rwlock)]` Tracking Issue: #134645 This PR continues the effort made in #144022 by adding the implementation of `nonpoison::rwlock`. Many of the changes here are similar to the changes made to implement `nonpoison::mutex`. The only real difference is that this PR includes a reorganizing of the existing `poison::rwlock` file that hopefully makes both variants more readable. ### Related PRs - `nonpoison_condvar` implementation: #144651 - `nonpoison_once` implementation: #144653
☔ The latest upstream changes (presumably #145773) made this pull request unmergeable. Please resolve the merge conflicts. |
Adds the equivalent `nonpoison` types to the `poison::condvar` module. These types and implementations are gated under the `nonpoison_condvar` feature gate. Signed-off-by: Connor Tsui <[email protected]>
I believe Thom has been out r? Libs |
Failed to set assignee to
|
r? libs |
Adds tests for the `nonpoison::Mutex` variant by using a macro to duplicate the existing `poison` tests. Note that all of the tests here are adapted from the existing `poison` tests. Also steals the `test_mutex_arc_condvar` test from `mutex.rs`. Signed-off-by: Connor Tsui <[email protected]>
Signed-off-by: Connor Tsui <[email protected]>
Since `WaitTimeoutResult` is poison-agnostic, we want to use the same type for both variants of `Condvar`. Signed-off-by: Connor Tsui <[email protected]>
de36753
to
b8ee38b
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Signed-off-by: Connor Tsui <[email protected]>
/// A type indicating whether a timed wait on a condition variable returned | ||
/// due to a time out or not. | ||
/// | ||
/// It is returned by the [`wait_timeout`] method. | ||
/// | ||
/// [`wait_timeout`]: Condvar::wait_timeout | ||
#[derive(Debug, PartialEq, Eq, Copy, Clone)] | ||
#[stable(feature = "wait_timeout", since = "1.5.0")] | ||
pub struct WaitTimeoutResult(bool); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not actually sure that this is the best place to put it, but I do think this is still better than leaving it in poison
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: since this is a semi-large file, it might be good to compare this directly with the poison::condvar
module (with the additional reorganizations made in the first commit)
(for copy paste)
delta library/std/src/sync/poison/condvar.rs library/std/src/sync/nonpoison/condvar.rs
diff library/std/src/sync/poison/condvar.rs library/std/src/sync/nonpoison/condvar.rs
nonpoison_and_poison_unwrap_test!( | ||
name: test_mutex_arc_condvar, | ||
test_body: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was stolen from mutex.rs
.
Other than that, there are no "new" tests here (just refactors to use the macro)
Tracking Issue: #134645
This PR continues the effort made in #144022 by adding the implementation of
nonpoison::condvar
.Many of the changes here are similar to the changes made to implement
nonpoison::mutex
.There are two other changes here. The first is that the
Barrier
implementation is migrated to use thenonpoison::Condvar
instead of thepoison
variant. The second (which might be subject to some discussion) is thatWaitTimeoutResult
is moved up tomod.rs
, as bothcondvar
variants need that type (and I do not know if there is a better place to put it now).Related PRs
nonpoison_rwlock
implementation: Implementation:#[feature(nonpoison_rwlock)]
#144648nonpoison_once
implementation: Implementation:#[feature(nonpoison_once)]
#144653