Skip to main content

spawn_host

Function spawn_host 

Source
pub fn spawn_host<B: Body>(
    opts: HostOptions,
    shutdown: CancellationToken,
    body: B,
) -> Result<HostHandle<B::Cmd>, SpawnError>
Expand description

Spawn a dedicated Commonware-runtime thread hosting body, rooted at opts.storage_dir, and returns once the thread has reported readiness.

§Errors

Returns SpawnError::Open if Body::open reports a failure (an eager host’s store could not be opened or recovered — INV-H2), or SpawnError::RuntimeStart if the dedicated thread panics before it can report either outcome.

§Panics

Panics if the OS refuses to spawn the dedicated thread (resource exhaustion).