-
Notifications
You must be signed in to change notification settings - Fork 13.9k
nonpoison::Condvar should take MutexGuard by reference
#148343
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
Conversation
Setup for writing different tests for the `nonpoison::Condvar` since it will have a different API. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
nonpoison::Condvar should take MutexGuard by reference
The poisoning version had to return a |
6c86243 to
2f152f1
Compare
Since non-poisoning `Condvar` take non-poisoing `Mutex`es when `wait`ing, we do not need to take by ownership since a poison error cannot occur while we wait. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
2f152f1 to
c1153b0
Compare
|
Ah I was thinking theoretically it could also have just returned a |
|
There is no poison flag in the |
|
Thanks for the quick review! I just changed a few other things on top of the comments (use |
|
@bors r+ |
|
Make sure to also update the signatures in the tracking issue. |
…Amanieu `nonpoison::Condvar` should take `MutexGuard` by reference Feature: `#![feature(nonpoison_condvar)]` Tracking Issue: rust-lang#134645 Specific comment: rust-lang#134645 (comment) Changes the `nonpoison::Condvar` API to take `MutexGuard` by reference instead of ownership. I'm actually not entirely sure why the current poison variant of `Condvar` takes by ownership, is it just legacy reasons? Additionally, the `nonpoison_and_poison_unwrap_test` macro doesn't really make sense anymore now that the APIs are completely different, so this reverts that change from a few months ago. r? `@Amanieu`
…Amanieu `nonpoison::Condvar` should take `MutexGuard` by reference Feature: `#![feature(nonpoison_condvar)]` Tracking Issue: rust-lang#134645 Specific comment: rust-lang#134645 (comment) Changes the `nonpoison::Condvar` API to take `MutexGuard` by reference instead of ownership. I'm actually not entirely sure why the current poison variant of `Condvar` takes by ownership, is it just legacy reasons? Additionally, the `nonpoison_and_poison_unwrap_test` macro doesn't really make sense anymore now that the APIs are completely different, so this reverts that change from a few months ago. r? ``@Amanieu``
…Amanieu `nonpoison::Condvar` should take `MutexGuard` by reference Feature: `#![feature(nonpoison_condvar)]` Tracking Issue: rust-lang#134645 Specific comment: rust-lang#134645 (comment) Changes the `nonpoison::Condvar` API to take `MutexGuard` by reference instead of ownership. I'm actually not entirely sure why the current poison variant of `Condvar` takes by ownership, is it just legacy reasons? Additionally, the `nonpoison_and_poison_unwrap_test` macro doesn't really make sense anymore now that the APIs are completely different, so this reverts that change from a few months ago. r? ```@Amanieu```
Rollup of 10 pull requests Successful merges: - #135602 (Tweak output of missing lifetime on associated type) - #139751 (Implement pin-project in pattern matching for `&pin mut|const T`) - #142682 (Update bundled musl to 1.2.5) - #148171 (Simplify code to generate line numbers in highlight) - #148263 (Unpin `libc` and `rustix` in `compiler` and `rustbook`) - #148301 ([rustdoc search] Include extern crates when filtering on `import`) - #148330 (Don't require dlltool with the dummy backend on MinGW) - #148338 (cleanup: upstream dropped amx-transpose functionality) - #148340 (Clippy subtree update) - #148343 (`nonpoison::Condvar` should take `MutexGuard` by reference) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #135602 (Tweak output of missing lifetime on associated type) - #139751 (Implement pin-project in pattern matching for `&pin mut|const T`) - #142682 (Update bundled musl to 1.2.5) - #148171 (Simplify code to generate line numbers in highlight) - #148263 (Unpin `libc` and `rustix` in `compiler` and `rustbook`) - #148301 ([rustdoc search] Include extern crates when filtering on `import`) - #148330 (Don't require dlltool with the dummy backend on MinGW) - #148338 (cleanup: upstream dropped amx-transpose functionality) - #148340 (Clippy subtree update) - #148343 (`nonpoison::Condvar` should take `MutexGuard` by reference) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #148343 - connortsui20:guard-ref-condvar, r=Amanieu `nonpoison::Condvar` should take `MutexGuard` by reference Feature: `#![feature(nonpoison_condvar)]` Tracking Issue: #134645 Specific comment: #134645 (comment) Changes the `nonpoison::Condvar` API to take `MutexGuard` by reference instead of ownership. I'm actually not entirely sure why the current poison variant of `Condvar` takes by ownership, is it just legacy reasons? Additionally, the `nonpoison_and_poison_unwrap_test` macro doesn't really make sense anymore now that the APIs are completely different, so this reverts that change from a few months ago. r? ````@Amanieu````
Feature:
#![feature(nonpoison_condvar)]Tracking Issue: #134645
Specific comment: #134645 (comment)
Changes the
nonpoison::CondvarAPI to takeMutexGuardby reference instead of ownership.I'm actually not entirely sure why the current poison variant of
Condvartakes by ownership, is it just legacy reasons?Additionally, the
nonpoison_and_poison_unwrap_testmacro doesn't really make sense anymore now that the APIs are completely different, so this reverts that change from a few months ago.r? @Amanieu