Skip to main content

once_a_second

Function once_a_second 

Source
fn once_a_second(gate: &AtomicU64) -> bool
Expand description

True at most once per wall-clock second per gate, for whichever caller gets there first.

A node in trouble is in trouble thousands of times a second and the log line is worth exactly one of them; the rest is in the counter beside it. swap, not load-then-store, so of the many threads arriving in the same second exactly one sees the old value.