pub struct RepeatCounters { /* private fields */ }Expand description
Live decrementing counters for every (ProcessId, term_index) pair
currently mid-repeat(N)@(...) wait. Mutex-guarded so Engine (which
reaches this only through a shared &self inside EngineNotifySink) can
call Self::on_term_fired/Self::clear from a &self-only context —
the same pattern every other sched shared-mutable-state field already
uses (NbaLog, RegionQueues, …).
Implementations§
Source§impl RepeatCounters
impl RepeatCounters
pub fn new() -> Self
Sourcepub fn on_term_fired(
&self,
proc: ProcessId,
term_index: usize,
declared_total: u64,
) -> RepeatOutcome
pub fn on_term_fired( &self, proc: ProcessId, term_index: usize, declared_total: u64, ) -> RepeatOutcome
Looks up (proc, term_index)’s live remaining count, initializing it
to declared_total on first sight (the first firing after the
process suspended), decrements by 1, and reports the outcome. At 0
post-decrement the entry is removed — so a later, unrelated
repeat(N)@(...) wait re-installed at the same term_index starts
fresh rather than inheriting a stale zero (see
clear_removes_only_the_named_processs_entries for the companion
“no stale residue after an explicit clear” proof).
Sourcepub fn clear(&self, proc: ProcessId)
pub fn clear(&self, proc: ProcessId)
Removes every counter entry belonging to proc, regardless of
term_index — called from the same place SensitivityTable:: remove_dynamic already is (sched::control’s dispatch_ready_set),
so a process that resumes via any path (an ordinary event match,
Disabled, …) never leaves a stale partial count behind for a
future, unrelated dynamic wait reusing the same term_index.