Skip to main content

require_self_test_started

Function require_self_test_started 

Source
pub fn require_self_test_started() -> Result<(), Error>
Expand description

Guard used at the entry point of every public *_internal function.

The *_internal functions perform an approved algorithm without the require_operational / require_allowed gates of the approved service, so that the power-up self-tests can drive them while the module is still in State::SelfTest. They are not approved services. This guard bounds when they run: it returns Ok(()) in State::Operational to every thread, and in State::SelfTest only to the thread running the power-up self-tests. It returns Error::NotOperational with the observed state to every other thread in SelfTest, so a call that arrives while initialisation is running, or paused, is refused, and to every thread in State::PowerOff, State::Error and State::IntegrityUnverified.

The Operational case is the same comparison require_operational makes, one acquire load and one compare, so any condition that gate imposes on the approved services applies here too. Only a call that finds SelfTest asks the operating system for its thread id.