Link: wasm-bindgen/pool.rs at main · rustwasm/wasm-bindgen · GitHub
Signature:
fn execute(&self, f: impl FnOnce() + Send + 'static) -> Result<Worker, JsValue> {
Context: this is part of a small 'library' which allows rayon style parallelism with webworkers.
Question:
-
Do these web workers share the same memory ?
-
If not, how is passing around closures work?
-
If so, how is the memory kept safe in light of multiple threads? All worker threads are limited to the same 2GB / 4GB of memory ?