pub fn spawn<'a, S, F>(env: Env<'a>, thread_fn: F)
Expand description
Implements threaded NIFs.
This spawns a thread that calls the given closure thread_fn
. When the closure returns, the
thread sends its return value back to the calling process. If the closure panics, an {error, Reason}
tuple is sent instead.
Note that the thread creates a new Env
and passes it to the closure, so the closure
runs under a separate environment, not under env
.