Lines Matching full:once
20 /// Current state of a `Once`.
37 /// Returns whether the associated `Once` has been poisoned.
39 /// Once an initialization routine for a `Once` has panicked it will forever
49 /// Returns whether the associated `Once` has successfully executed a
64 /// # Differences from the standard library `Once`
75 /// use parking_lot::Once;
77 /// static START: Once = Once::new();
83 pub struct Once(AtomicU8); struct
85 impl Once { impl
86 /// Creates a new `Once` value.
88 pub const fn new() -> Once { in new()
89 Once(AtomicU8::new(0)) in new()
92 /// Returns the current state of this `Once`.
107 /// Performs an initialization routine once and only once. The given closure
124 /// use parking_lot::Once;
127 /// static INIT: Once = Once::new();
130 /// // in a synchronized fashion (e.g. write once or read all) then we're
133 /// // This function will only call `expensive_computation` once, and will
152 /// The closure `f` will only be executed once if this is called
154 /// it will *poison* this `Once` instance, causing all future invocations of
171 /// If this `Once` has been poisoned (some initialization panicked) then
176 /// state of this `Once` (whether initialization has previously panicked or
221 panic!("Once instance has previously been poisoned"); in call_once_slow()
281 struct PanicGuard<'a>(&'a Once); in call_once_slow()
285 let once = self.0; in call_once_slow() localVariable
286 let state = once.0.swap(POISON_BIT, Ordering::Release); in call_once_slow()
288 let addr = once as *const _ as usize; in call_once_slow()
318 impl Default for Once { implementation
320 fn default() -> Once { in default()
321 Once::new() in default()
325 impl fmt::Debug for Once { implementation
327 f.debug_struct("Once") in fmt()
335 use crate::Once;
342 static O: Once = Once::new(); in smoke_once()
352 static O: Once = Once::new(); in stampede_once()
388 static O: Once = Once::new(); in poison_bad()
390 // poison the once in poison_bad()
410 // once any success happens, we stop propagating the poison in poison_bad()
416 static O: Once = Once::new(); in wait_for_force_to_finish()
418 // poison the once in wait_for_force_to_finish()
424 // make sure someone's waiting inside the once via a force in wait_for_force_to_finish()
437 // put another waiter on the once in wait_for_force_to_finish()
454 static O: Once = Once::new(); in test_once_debug()
456 assert_eq!(format!("{:?}", O), "Once { state: New }"); in test_once_debug()