Skip to main content

daemon

Function daemon 

pub fn daemon(name: &'static str) -> Daemon
Expand description

A multi-thread runtime for the service name.

Workers default to the available parallelism, capped at Daemon::DEFAULT_MAX_WORKERS: a service waits on sockets and disks, and more workers than that only add contention. The blocking pool defaults to Daemon::DEFAULT_MAX_BLOCKING threads instead of tokio’s 512, so a burst of blocking calls queues rather than spawning hundreds of threads. Threads are named {name}-rt-N, workers and blocking-pool threads alike: tokio hands a new thread whichever job is queued, so a name given at spawn cannot tell the two apart.