about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-03-17 19:01:50 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-03-26 10:33:14 -0700
commitc966c330c962f8479882c28a0e430142ef53ee5a (patch)
treed895008cc748707d97f6be396ab0bf64a07e15e9 /src/libstd/sys/unix/stack_overflow.rs
parentdcfb8d72e99425686376298fd793715f35b5d512 (diff)
downloadrust-c966c330c962f8479882c28a0e430142ef53ee5a.tar.gz
rust-c966c330c962f8479882c28a0e430142ef53ee5a.zip
std: Rewrite Once with poisoning
This commit rewrites the `std::sync::Once` primitive with poisoning in mind in
light of #31688. Currently a panic in the initialization closure will cause
future initialization closures to run, but the purpose of a Once is usually to
initialize some global state so it's highly likely that the global state is
corrupt if a panic happened. The same strategy of a mutex is taken where a panic
is propagated by default.

A new API, `call_once_force`, was added to subvert panics like is available on
Mutex as well (for when panicking is handled internally).

Adding this support was a significant enough change to the implementation that
it was just completely rewritten from scratch, primarily to avoid using a
`StaticMutex` which needs to have `destroy()` called on it at some point (a pain
to do).

Closes #31688
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions