Skip to main content

spawn_worker

Function spawn_worker 

Source
pub fn spawn_worker(url: &str) -> i32
Expand description

Spawn a background worker from a .wasm module URL.

The worker runs on its own thread with isolated fuel and linear memory. Its start_app() runs once on spawn; it then receives messages through its exported on_message(len: u32) and replies via worker_post.

url may be http(s) or file://. Use url_resolve against get_url to load a worker module sitting next to the current app.

Returns a handle (> 0) on success, or -1 on error.