Rust: Tracking issue for std::sync::Once poisoning

Created on 12 May 2016  路  12Comments  路  Source: rust-lang/rust

This tracks the once_poison feature, which currently covers the following things under std::sync::once:

  • [ ] OnceState, a struct describing the poisonedness of a Once
  • [ ] OnceState::poisoned, which reveals said poisonedness
  • [ ] Once::call_once_force, which is like call_once but ignores poisoning
A-concurrency B-unstable C-tracking-issue Libs-Tracked T-libs disposition-merge finished-final-comment-period

Most helpful comment

Apart from consistency I find is_poisoned more clear than poisoned. The latter sounds a bit like a constructor that creates a poisoned instance.

All 12 comments

This issue is primarily about the call_once_force method. Once implements poisoning, and this method is how you get around a poisoned Once.

~Anyone have insight why poisoned is not just a method on Once?~

EDIT: nevermind

This naming seems inconsistent:

Could they both be is_poisoned since that one is stable already? Or is poisoned better enough that we should deprecate and rename the one on Mutex?

Relevant: #43448 contains discussion of whether forking a process should cause poisoning of various synchronization primitives. TLDR: An option is to make it so that if you fork while a Once is in use, thus invalidating it, that Once becomes poisoned.

Triage: no changes here that I'm aware of.

43448 was closed. @joshlf Can this issue be expedited, without discussing more than one scenario in which the state should be poisoned?

Yes, the "poison on fork" proposal should be considered dead for the time being. The discussion in this issue can safely ignore that proposal.

I think this API is well designed and worth stabilizing. Note that parking_lot uses a difference OnceState, but I think the current one we have in libstd is fine as it is.

@rfcbot fcp merge

Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members:

  • [x] @Amanieu
  • [ ] @SimonSapin
  • [x] @dtolnay
  • [x] @sfackler
  • [ ] @withoutboats

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

:bell: This is now entering its final comment period, as per the review above. :bell:

Apart from consistency I find is_poisoned more clear than poisoned. The latter sounds a bit like a constructor that creates a poisoned instance.

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

Was this page helpful?
0 / 5 - 0 ratings