Skip to main content

finish_shutdown

Function finish_shutdown 

Source
pub fn finish_shutdown() -> Result<(), RuntimeConfigError>
Expand description

Phase 2 of a two-phase shutdown: wait for the generation to go idle, join the workers and publish the stop.

Completes the most recently announced stop, whichever thread performs the join, and is idempotent: extra calls, and calls that race another thread completing the same shutdown, answer Ok(()). A call that arrives after a start finds nothing outstanding and is a no-op – it never stops the generation that restart published. It errors only when no begin_shutdown has EVER been called on this runtime, and when called from work of the generation being stopped. Calling it while runtime_work_pending still answers true is allowed – it then blocks, which is what shutdown does.