start_next_top_level_if_idle

Function start_next_top_level_if_idle 

Source
pub(super) fn start_next_top_level_if_idle(
    state: &mut HostState,
) -> DispatchOutput
Expand description

Internal helper: if in_flight is None and queue has work, pop the front and start it. Emits TopLevelCreationRequested, TopLevelCreationStarted, Effect::PostCreateWindow, and updated queue length.

Quit gating (codex P1 PR #654 round 1): if quit_state != Running, don’t start anything — queued background requests stay queued but will never fire (host is exiting; in-memory queue dies with the process). Without this guard, an in-flight completion during Draining would pop a queued background pool refill and emit Effect::PostCreateWindow, creating a new window mid-shutdown and preventing drain completion.