Lines Matching full:snapshot
13 pub(super) struct Snapshot(usize); struct
15 type UpdateResult = Result<Snapshot, Snapshot>;
109 pub(super) fn load(&self) -> Snapshot { in load() argument
110 Snapshot(self.val.load(Acquire)) in load()
183 pub(super) fn transition_to_complete(&self) -> Snapshot { in transition_to_complete() argument
186 let prev = Snapshot(self.val.fetch_xor(DELTA, AcqRel)); in transition_to_complete()
190 Snapshot(prev.0 ^ DELTA) in transition_to_complete()
198 let prev = Snapshot(self.val.fetch_sub(count * REF_ONE, AcqRel)); in transition_to_terminal()
215 self.fetch_update_action(|mut snapshot| { in transition_to_notified_by_val()
218 if snapshot.is_running() { in transition_to_notified_by_val()
222 snapshot.set_notified(); in transition_to_notified_by_val()
223 snapshot.ref_dec(); in transition_to_notified_by_val()
226 assert!(snapshot.ref_count() > 0); in transition_to_notified_by_val()
229 } else if snapshot.is_complete() || snapshot.is_notified() { in transition_to_notified_by_val()
232 snapshot.ref_dec(); in transition_to_notified_by_val()
234 if snapshot.ref_count() == 0 { in transition_to_notified_by_val()
242 snapshot.set_notified(); in transition_to_notified_by_val()
243 snapshot.ref_inc(); in transition_to_notified_by_val()
247 (action, Some(snapshot)) in transition_to_notified_by_val()
253 self.fetch_update_action(|mut snapshot| { in transition_to_notified_by_ref()
254 if snapshot.is_complete() || snapshot.is_notified() { in transition_to_notified_by_ref()
257 } else if snapshot.is_running() { in transition_to_notified_by_ref()
261 snapshot.set_notified(); in transition_to_notified_by_ref()
262 (TransitionToNotifiedByRef::DoNothing, Some(snapshot)) in transition_to_notified_by_ref()
266 snapshot.set_notified(); in transition_to_notified_by_ref()
267 snapshot.ref_inc(); in transition_to_notified_by_ref()
268 (TransitionToNotifiedByRef::Submit, Some(snapshot)) in transition_to_notified_by_ref()
278 self.fetch_update_action(|mut snapshot| { in transition_to_notified_and_cancel()
279 if snapshot.is_cancelled() || snapshot.is_complete() { in transition_to_notified_and_cancel()
282 } else if snapshot.is_running() { in transition_to_notified_and_cancel()
290 snapshot.set_notified(); in transition_to_notified_and_cancel()
291 snapshot.set_cancelled(); in transition_to_notified_and_cancel()
292 (false, Some(snapshot)) in transition_to_notified_and_cancel()
297 snapshot.set_cancelled(); in transition_to_notified_and_cancel()
298 if !snapshot.is_notified() { in transition_to_notified_and_cancel()
299 snapshot.set_notified(); in transition_to_notified_and_cancel()
300 snapshot.ref_inc(); in transition_to_notified_and_cancel()
301 (true, Some(snapshot)) in transition_to_notified_and_cancel()
303 (false, Some(snapshot)) in transition_to_notified_and_cancel()
313 let mut prev = Snapshot(0); in transition_to_shutdown()
315 let _ = self.fetch_update(|mut snapshot| { in transition_to_shutdown()
316 prev = snapshot; in transition_to_shutdown()
318 if snapshot.is_idle() { in transition_to_shutdown()
319 snapshot.set_running(); in transition_to_shutdown()
325 snapshot.set_cancelled(); in transition_to_shutdown()
326 Some(snapshot) in transition_to_shutdown()
439 let prev = Snapshot(self.val.fetch_sub(REF_ONE, AcqRel)); in ref_dec()
446 let prev = Snapshot(self.val.fetch_sub(2 * REF_ONE, AcqRel)); in ref_dec_twice()
453 F: FnMut(Snapshot) -> (T, Option<Snapshot>), in fetch_update_action() argument
468 Err(actual) => curr = Snapshot(actual), in fetch_update_action()
473 fn fetch_update<F>(&self, mut f: F) -> Result<Snapshot, Snapshot> in fetch_update() argument
475 F: FnMut(Snapshot) -> Option<Snapshot>, in fetch_update() argument
489 Err(actual) => curr = Snapshot(actual), in fetch_update()
495 // ===== impl Snapshot =====
497 impl Snapshot { implementation
578 let snapshot = self.load(); in fmt() localVariable
579 snapshot.fmt(fmt) in fmt()
583 impl fmt::Debug for Snapshot { implementation
585 fmt.debug_struct("Snapshot") in fmt()