We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
once_lock
1 parent c2b84fb commit 43b1e0cCopy full SHA for 43b1e0c
1 file changed
library/std/src/sync/once_lock.rs
@@ -104,9 +104,10 @@ use crate::sync::Once;
104
/// ```
105
#[stable(feature = "once_cell", since = "1.70.0")]
106
pub struct OnceLock<T> {
107
- // FIXME(nonpoison_once): switch to nonpoison version once it is available
+ /// We use `poison::Once` here to allow us to pseudo-"poison" the `Once` whenever a
108
+ /// `get_or_try_init` fails, which allows other calls to be run after a failure.
109
once: Once,
- // Whether or not the value is initialized is tracked by `once.is_completed()`.
110
+ /// Note that `once.is_completed()` tells us if the value is initialized or not.
111
value: UnsafeCell<MaybeUninit<T>>,
112
/// `PhantomData` to make sure dropck understands we're dropping T in our Drop impl.
113
///
0 commit comments