Skip to main content

note_release_timer_started

Function note_release_timer_started 

Source
pub(crate) fn note_release_timer_started(backend: TimerBackend)
Expand description

Publish the fact that the process-wide release thread now exists.

release_timer.rs is the only caller, and must call it from inside shared()’s one-time initialiser — after ReleaseTimer::new() has resolved a backend, and not from ReleaseTimer::new() itself, which also runs for the owned wheels this module’s tests and any per-socket owner construct. Publishing from new() would make release_timer_started report a process-wide thread that does not exist.

The state lives here rather than in release_timer.rs so that instrument.rs compiles standing alone, depending on nothing else in the crate, and so there is exactly one source of truth for a value two modules expose. release_timer::started() / release_timer::backend() read it back through the two public functions above.

First writer wins; later calls are ignored, which keeps the value monotonic even if a future caller gets the “once” wrong.

This function is pub(crate) and has no #[allow(dead_code)] on purpose: if release_timer.rs never calls it, -D warnings fails the build rather than leaving release_timer_started() silently stuck at false — which is the direction that would make the tests asserting that no release thread was started pass for the wrong reason.