duat_core::thread

Function spawn

Source
pub fn spawn<R: Send + 'static>(
    f: impl FnOnce() -> R + Send + 'static,
) -> JoinHandle<R>
Expand description

Spawns a new thread, returning a JoinHandle for it.

Use this function instead of std::thread::spawn.

The threads from this function work in the same way that threads from std::thread::spawn work, but it has synchronicity with Duat, and makes sure that the application won’t exit or reload the configuration before all spawned threads have stopped.