Skip to main content

spawn

Function spawn 

Source
pub fn spawn<F, T>(
    name: &str,
    what: &str,
    work: F,
) -> Result<JoinHandle<T>, StartError>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Start a thread named name, which is what, such as “the tracing thread”, to run work, retrying while the system cannot start it for the moment.

§Errors

A StartError when the system refuses the thread with an error other than EAGAIN, at once, or when its tenth retry fails with EAGAIN, after every wait of WAITS. A name that holds a NUL byte is refused without an attempt. The work never runs then.