class Thread
pub class Thread
An operating-system thread with a scheduler of its own.
A task never moves to another thread. What threads share, they share through a channel, an atomic or a lock — anything else is a data race.
Methods
pub static fn spawn<T, E :: [Error]>(body: fn() -> T throws E): (Task<T> throws E)
Starts a thread with a scheduler of its own and returns the handle of its first task,
body.
await() on the handle waits for the task's end from any thread, and what the task did
happens before the wait returns. The handle is done when that task ends. The thread then
cancels what still lives on it and runs until all of it has ended: the defers run, the
locks come free, and whoever awaits one of those tasks goes on. Only the program ends with
its first task and leaves the rest where it stands.