Expand description
Tokio runtime ownership.
Kerniq never creates a runtime behind the user’s back. There are exactly two modes:
- User-managed (
app.run(addr).await): the application owns the runtime, typically through#[tokio::main]. Kerniq only spawns tasks on it. - Framework-managed (
app.run_blocking(addr)): Kerniq builds a multi-threaded runtime, runs the server to completion and shuts the runtime down. This is refused withServerError::NestedRuntimewhen called from inside an existing runtime, because Tokio cannot nest runtimes (it would panic).
Functions§
- block_
on - Builds a multi-threaded runtime, drives
futureto completion and shuts the runtime down, waiting at mostshutdown_timeoutfor stray tasks. - in_
runtime - Whether the current thread is inside a Tokio runtime context.