Skip to main content

leave_read_only

Function leave_read_only 

Source
pub async fn leave_read_only()
Expand description

Return to a region where writing is legal.

The ReadOnly region belongs to the simulator, not to the test that asked for it. prime_ro’s callback sets the phase, wakes the waiters, drains the executor and only then restores Normal — and the drain is not confined to the waiters it woke. Whatever else the executor has queued runs in the same drain, inside the same cbReadOnlySynch callback. When the test that awaited ReadOnly finishes there, the thing that runs next is the regression loop, and after that the next test’s first statement (D108).

One precision step is the whole of it. There is no cheaper exit: a zero-delay cbAfterDelay registered from inside the ReadOnly callback would land in the current time step, and Icarus refuses that outright — SCHEDULER ERROR: read-only sync events created RW events! and the run stops. Once the read-only region of a time step has begun, that time step has no writable region left, so leaving costs time by construction.

A no-op when the simulation is not in ReadOnly, which is the usual case: a test whose predecessor ended normally starts exactly where it used to.