[][src]Trait rustler::thread::JobSpawner

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.

Loading content...

Implementors

impl JobSpawner for ThreadSpawner[src]

fn spawn<F: FnOnce() + Send + UnwindSafe + 'static>(job: F)[src]

This delegates to std::thread::spawn().

Loading content...