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

Add Mutex::with #61976

Closed
wants to merge 2 commits into from
Closed

Add Mutex::with #61976

wants to merge 2 commits into from

Conversation

jsgf
Copy link
Contributor

@jsgf jsgf commented Jun 19, 2019

Helper which makes taking a Mutex for the duration of a single closure lower friction.

Issue #61974

@rust-highfive
Copy link
Collaborator

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 19, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:13338fc0:start=1560983167396136177,finish=1560983168177490865,duration=781354688
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:07:11] 
[01:07:11] running 9 tests
[01:07:11] iiiiiiiii
[01:07:11] 
[01:07:11]  finished in 0.152
[01:07:11] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:07:27] 
[01:07:27] running 122 tests
[01:07:53] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:07:58] .i.i......iii.i.....ii
[01:07:58] 
[01:07:58]  finished in 30.631
[01:07:58] travis_fold:end:test_debuginfo

---
[01:24:23] ..................................................i..i.......................................iiii... 400/927
[01:24:34] ....ii.............................................................................................. 500/927
[01:24:39] .................................................................................................... 600/927
[01:24:48] ..................................................iiii.............................................. 700/927
[01:25:03] .....................................................................F.............................. 800/927
[01:25:11] ...........................
[01:25:11] failures:
[01:25:11] 
[01:25:11] ---- sync/mutex.rs - sync::mutex::Mutex<T>::with (line 374) stdout ----
[01:25:11] ---- sync/mutex.rs - sync::mutex::Mutex<T>::with (line 374) stdout ----
[01:25:11] error[E0425]: cannot find value `old` in this scope
[01:25:11]  --> sync/mutex.rs:380:28
[01:25:11]   |
[01:25:11] 9 | let old = mutex.with(|v| { old = v; *v += 1; old }).unwrap();
[01:25:11] 
[01:25:11] error[E0425]: cannot find value `old` in this scope
[01:25:11]  --> sync/mutex.rs:380:46
[01:25:11]   |
[01:25:11]   |
[01:25:11] 9 | let old = mutex.with(|v| { old = v; *v += 1; old }).unwrap();
[01:25:11] 
[01:25:11] 
[01:25:11] error[E0658]: use of unstable library feature 'mutex_with'
[01:25:11]  --> sync/mutex.rs:380:17
[01:25:11]   |
[01:25:11] 9 | let old = mutex.with(|v| { old = v; *v += 1; old }).unwrap();
[01:25:11]   |
[01:25:11]   = note: for more information, see https://github.com/rust-lang/rust/issues/61974
[01:25:11]   = note: for more information, see https://github.com/rust-lang/rust/issues/61974
[01:25:11]   = help: add #![feature(mutex_with)] to the crate attributes to enable
[01:25:11] error: aborting due to 3 previous errors
[01:25:11] 
[01:25:11] Some errors have detailed explanations: E0425, E0658.
[01:25:11] For more information about an error, try `rustc --explain E0425`.
---
[01:25:11] 
[01:25:11] error: test failed, to rerun pass '--doc'
[01:25:11] 
[01:25:11] 
[01:25:11] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:25:11] 
[01:25:11] 
[01:25:11] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:25:11] Build completed unsuccessfully in 1:20:16
---
travis_time:end:18564150:start=1560988291969317982,finish=1560988291974093087,duration=4775105
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:014f6fae
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:12d1e080
travis_time:start:12d1e080
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:295635e4
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0f3d16ce:start=1560988541798627538,finish=1560988542542871746,duration=744244208
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:19] 
[01:05:19] running 9 tests
[01:05:19] iiiiiiiii
[01:05:19] 
[01:05:19]  finished in 0.155
[01:05:19] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:05:35] 
[01:05:35] running 122 tests
[01:06:00] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:06:05] .i.i......iii.i.....ii
[01:06:05] 
[01:06:05]  finished in 29.934
[01:06:05] travis_fold:end:test_debuginfo

---
[01:22:13] ..................................................i..i.......................................iiii... 400/927
[01:22:23] ....ii.............................................................................................. 500/927
[01:22:27] .................................................................................................... 600/927
[01:22:36] ..................................................iiii.............................................. 700/927
[01:22:50] .....................................................................F.............................. 800/927
[01:22:59] ...........................
[01:22:59] failures:
[01:22:59] 
[01:22:59] ---- sync/mutex.rs - sync::mutex::Mutex<T>::with (line 374) stdout ----
[01:22:59] ---- sync/mutex.rs - sync::mutex::Mutex<T>::with (line 374) stdout ----
[01:22:59] error[E0658]: use of unstable library feature 'mutex_with'
[01:22:59]  --> sync/mutex.rs:380:17
[01:22:59]   |
[01:22:59] 9 | let old = mutex.with(|v| { let old = v; *v += 1; old }).unwrap();
[01:22:59]   |
[01:22:59]   = note: for more information, see https://github.com/rust-lang/rust/issues/61974
[01:22:59]   = note: for more information, see https://github.com/rust-lang/rust/issues/61974
[01:22:59]   = help: add #![feature(mutex_with)] to the crate attributes to enable
[01:22:59] 
[01:22:59] error[E0277]: can't compare `&mut {integer}` with `{integer}`
[01:22:59]   --> sync/mutex.rs:382:1
[01:22:59] 11 | assert_eq!(old, 0);
[01:22:59] 11 | assert_eq!(old, 0);
[01:22:59]    | ^^^^^^^^^^^^^^^^^^^ no implementation for `&mut {integer} == {integer}`
[01:22:59]    |
[01:22:59]    = help: the trait `std::cmp::PartialEq<{integer}>` is not implemented for `&mut {integer}`
[01:22:59] 
[01:22:59] error: aborting due to 2 previous errors
[01:22:59] 
[01:22:59] Some errors have detailed explanations: E0277, E0658.
---
[01:22:59] 
[01:22:59] error: test failed, to rerun pass '--doc'
[01:22:59] 
[01:22:59] 
[01:22:59] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:22:59] 
[01:22:59] 
[01:22:59] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:22:59] Build completed unsuccessfully in 1:18:14
---
travis_time:end:148c203c:start=1560993534474586616,finish=1560993534479135248,duration=4548632
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:27c2d3ec
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1056ce70
travis_time:start:1056ce70
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:1f903f0a
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

pub fn with<U>(
&self,
func: impl FnOnce(&mut T) -> U,
) -> Result<U, PoisonError<MutexGuard<'_, T>>> {
Copy link
Member

Choose a reason for hiding this comment

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

Why would the PoisonError contain the guard in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was making it as similar to LockResult as possible, with the same error type. I guess the rationale is that if you have a poisoned lock, and you can actually recover from that, then having the guard would allow you to do so. On the other hand, that's at odds with point of this API, which is to be simple and low fuss.

I think the alternatives are:

  1. Use PoisonError<()>
  2. Don't return Result at all, and just panic on a poisoned lock

Since I think poisoned locks are unrecoverable in practice, 2. is possibly justifiable, but it seems a bit rude for a libstd function to do that. And as far as 1. goes, if we're going to return an error anyway, it may as well have the guard in it, even if its never used in practice.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could add a try_with variant for the non-panicing version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So with panics, try_with returns a Result?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that's the idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated to include try_with, but TBH I think it is overkill. I don't think this

match mx.with(|v| *v += 1234) {
Ok(()) => (),
Err(err) => ... handle err ...,

is any improvement over this:

match mx.lock() {
Ok(lk) => *lk += 1234,
Err(err) => ... handle err ...,
}

src/libstd/sync/mutex.rs Outdated Show resolved Hide resolved
/// assert_eq!(*mutex.lock().unwrap(), 1);
/// ```
#[unstable(feature = "mutex_with", issue = "61974")]
pub fn with<U>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn with<U>(
pub fn with<U, F: FnOnce(&mut T) -> U>(

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:1bdb10b2:start=1561010002223205726,finish=1561010091696714849,duration=89473509123
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:03:26] 
[01:03:26] running 9 tests
[01:03:26] iiiiiiiii
[01:03:26] 
[01:03:26]  finished in 0.145
[01:03:26] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:03:42] 
[01:03:42] running 122 tests
[01:04:06] .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....i..........iiii..........i...ii...i.......ii.i 100/122
[01:04:11] .i.i......iii.i.....ii
[01:04:11] 
[01:04:11]  finished in 28.916
[01:04:11] travis_fold:end:test_debuginfo

---
[01:19:49] ..................................................i..i.......................................iiii... 400/927
[01:19:59] ....ii.............................................................................................. 500/927
[01:20:03] .................................................................................................... 600/927
[01:20:12] ..................................................iiii.............................................. 700/927
[01:20:27] ......................................................................F............................. 800/927
[01:20:35] ...........................
[01:20:35] failures:
[01:20:35] 
[01:20:35] ---- sync/mutex.rs - sync::mutex::Mutex<T>::with (line 374) stdout ----
[01:20:35] ---- sync/mutex.rs - sync::mutex::Mutex<T>::with (line 374) stdout ----
[01:20:35] error[E0658]: use of unstable library feature 'mutex_with'
[01:20:35]  --> sync/mutex.rs:380:17
[01:20:35]   |
[01:20:35] 9 | let old = mutex.with(|v| { let old = *v; *v += 1; old }).unwrap();
[01:20:35]   |
[01:20:35]   = note: for more information, see https://github.com/rust-lang/rust/issues/61974
[01:20:35]   = note: for more information, see https://github.com/rust-lang/rust/issues/61974
[01:20:35]   = help: add #![feature(mutex_with)] to the crate attributes to enable
[01:20:35] error: aborting due to previous error
[01:20:35] 
[01:20:35] For more information about this error, try `rustc --explain E0658`.
[01:20:35] Couldn't compile the test.
---
[01:20:35] 
[01:20:35] error: test failed, to rerun pass '--doc'
[01:20:35] 
[01:20:35] 
[01:20:35] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:20:35] 
[01:20:35] 
[01:20:35] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:20:35] Build completed unsuccessfully in 1:16:37
---
travis_time:end:2c39fef8:start=1561014937184572312,finish=1561014937189228075,duration=4655763
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:10af183d
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:152cc5ce
travis_time:start:152cc5ce
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:03269352
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@jsgf
Copy link
Contributor Author

jsgf commented Jun 20, 2019

@Centril @sfackler What's the story for doc tests for unstable features? Do they have a #![feature(...)] line in the test?

@Centril
Copy link
Contributor

Centril commented Jun 20, 2019

@jsgf Yep.

@jsgf
Copy link
Contributor Author

jsgf commented Jun 21, 2019

I added Mutex::try_with which returns Result and Mutex::with which panics on poisoned locks.

I also added RwLock::with_read, with_write, try_with_read, try_with_write for consistency.

@jsgf
Copy link
Contributor Author

jsgf commented Jun 21, 2019

Tho I'm inclined to drop the try variants - we can add them later if they turn out to be useful.

@edmilsonefs
Copy link

Hey! This is a ping from triage, we would like to know if you @sfackler could give us a few more minutes to update us from last changes made by @jsgf .

Thanks.

@jsgf
Copy link
Contributor Author

jsgf commented Jul 12, 2019

I would definitely like feedback about whether to include the Result-returning try_ variants, or just go with panic-on-poison with. I'm biased towards the latter, but happy to go the other way if that's the consensus.

@JohnCSimon JohnCSimon added the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Jul 27, 2019
@JohnCSimon
Copy link
Member

@rust-lang/core Hello from triage, can this PR have another reviewer? Thanks.

@Manishearth
Copy link
Member

Please don't ping core from triage.

@rust-lang/libs is who you want

(Shouldn't this PR come with an RFC? I guess it's fine if it's unstable but we usually RFC those)

@Centril
Copy link
Contributor

Centril commented Jul 27, 2019

@Manishearth As I understand it, standard practice for most libs features is to do it by PR if 2-3 people agree its a good idea and maybe a libs team reviewer for a larger change or if there are design questions. (unless it has lang implications...)

@Amanieu
Copy link
Member

Amanieu commented Jul 27, 2019

try_with feels very misleading here since I would intuitively expect it to perform a try_lock rather than lock. IMO it should just be dropped since with is just a convenience wrapper around lock.

@alexcrichton
Copy link
Member

Reading the current state of the PR, I'd agree with @Amanieu and add that I found the implementations of the functions added here to be pretty surprising in terms of how they handled poisoning and such. The functions seem very small and not really adding much benefit over calling .lock().map(...) anyway, so I'm not certain myself that these implementations (as-is) should be going into the standard library.

@jsgf
Copy link
Contributor Author

jsgf commented Jul 31, 2019

I agree with the criticism of try_with - try is ambiguous in this context, and the functionality it provides isn't useful.

I proposed plain with because I've encountered several local implementations of it in our codebase (both as a free function and as part of a MutexExt trait), and it seemed like a useful extension to basic Mutex. .lock().map(...).unwrap() is not really equivalent because the map is getting the guard rather than the underlying locked object; the convenience of with is that it completely removes the guard from the equation.

And sure its just a deref away, but its a lot of extra noise. Something like:

let res = mutex.with(|inner| undulate(inner));

is a lot cleaner than

let res = mutex.map(|guard| undulate(&mut *guard).unwrap();

@Dylan-DPC-zz Dylan-DPC-zz removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Aug 1, 2019
Helper which makes taking a `Mutex` for the duration of a single closure lower friction.

Issue rust-lang#61974
@jsgf
Copy link
Contributor Author

jsgf commented Aug 3, 2019

Rebased; removed confusing try_ variants, just leaving basic with/with_read/with_write.

@alexcrichton
Copy link
Member

That's a good point about dereferencing the guards returned. I feel like this API as-is would be reasonable if we didn't have poisioning, but with mutexes that support poisoning it seems out of place as one of the only APIs that doesn't operate with a result.

If you do indeed return a result then the comparison between the two APIs I think is much less compelling:

let res = mutex.with(|inner| undulate(inner)).unwrap();
// ... vs ...
let res = mutex.map(|inner| undulate(&mut *inner).unwrap();

I don't think anyone will argue that the latter is more ergonomic, but I'm not sure it's more ergonomic enough to warrant a new API.

@jsgf
Copy link
Contributor Author

jsgf commented Aug 5, 2019

Yeah. I was trying to find any examples of anyone using poison for anything other than unwrap/expect, but couldn't find any. This diff is basically treating poison as legacy API cruft.

@alexcrichton
Copy link
Member

If that's the case I don't think that can really happen on this PR. I don't think we should add a one-off API that takes poisoning as API cruft, but we can of course have a discussion about poisoning in general and how to handle it.

@JohnCSimon
Copy link
Member

Hello from triage
@alexcrichton @jsgf @sfackler I'm unsure what should be done with this PR itself.
Thank you.

@jsgf
Copy link
Contributor Author

jsgf commented Aug 18, 2019

I think we're at an impasse. I think this is useful on its own terms, but it does introduce a new policy for handling poisoned locks (always panic rather than giving the caller an option to handle it).

So I think the best option for now is to mothball it and revisit later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants