Trait rustler::thread::JobSpawner [−][src]
pub trait JobSpawner { fn spawn<F: FnOnce() + Send + UnwindSafe + 'static>(job: F); }
A JobSpawner
is a value that can run Rust code on non-Erlang system threads.
Abstracts away details of thread management for spawn()
.
Note: Implementations of spawn()
must call the closure on a thread that is not managed by
the Erlang VM's scheduler. Otherwise, rustler::thread::spawn()
would try to send a message
from an OwnedEnv
on an Erlang thread, which would panic.
Required Methods
fn spawn<F: FnOnce() + Send + UnwindSafe + 'static>(job: F)
Run the given closure on another thread.
Implementors
impl JobSpawner for ThreadSpawner