Skip to main content

stop_runtime

Function stop_runtime 

Source
pub fn stop_runtime(runtime: Runtime, grace: Duration)
Expand description

Stops runtime, waiting at most blocking_grace for its blocking tasks.

The replacement for dropping the runtime, which tokio documents as blocking indefinitely for blocking tasks that have started. What this buys is a bounded exit; what it costs is that a thread still inside the resolver is left running, and the process exits with it. That is sound because the thread owns nothing the exit needs: its permit is server state that dies with the process, and its answer is for a request that was abandoned when connect_timeout expired.