|
13 | 13 | //! the panics are recognized reliably or on a best-effort basis depend on the |
14 | 14 | //! primitive. See [Overview](#overview) below. |
15 | 15 | //! |
16 | | -//! For the alternative implementations that do not employ poisoning, |
17 | | -//! see [`std::sync::nonpoison`]. |
| 16 | +//! The synchronization objects in this module have alternative implementations that do not employ |
| 17 | +//! poisoning in the [`std::sync::nonpoison`] module. |
18 | 18 | //! |
19 | 19 | //! [`std::sync::nonpoison`]: crate::sync::nonpoison |
20 | 20 | //! |
|
42 | 42 | //! [`Mutex::lock()`] returns a [`LockResult`], providing a way to deal with |
43 | 43 | //! the poisoned state. See [`Mutex`'s documentation](Mutex#poisoning) for more. |
44 | 44 | //! |
45 | | -//! - [`Once`]: A thread-safe way to run a piece of code only once. |
46 | | -//! Mostly useful for implementing one-time global initialization. |
47 | | -//! |
48 | | -//! [`Once`] is reliably poisoned if the piece of code passed to |
49 | | -//! [`Once::call_once()`] or [`Once::call_once_force()`] panics. |
50 | | -//! When in poisoned state, subsequent calls to [`Once::call_once()`] will panic too. |
51 | | -//! [`Once::call_once_force()`] can be used to clear the poisoned state. |
52 | | -//! |
53 | 45 | //! - [`RwLock`]: Provides a mutual exclusion mechanism which allows |
54 | 46 | //! multiple readers at the same time, while allowing only one |
55 | 47 | //! writer at a time. In some cases, this can be more efficient than |
|
59 | 51 | //! Note, however, that an `RwLock` may only be poisoned if a panic occurs |
60 | 52 | //! while it is locked exclusively (write mode). If a panic occurs in any reader, |
61 | 53 | //! then the lock will not be poisoned. |
| 54 | +//! |
| 55 | +//! Note that the [`Once`] type also employs poisoning, but since it has non-poisoning `force` |
| 56 | +//! methods available on it, there is no separate `nonpoison` and `poison` version. |
| 57 | +//! |
| 58 | +//! [`Once`]: crate::sync::Once |
62 | 59 |
|
63 | 60 | // If we are not unwinding, `PoisonError` is uninhabited. |
64 | 61 | #![cfg_attr(not(panic = "unwind"), expect(unreachable_code))] |
|
0 commit comments