Pointers in WASM and Web Workers

I'm trying to come up with a solution to creating a basic worker pool for running blocking tasks in the browser using wasm-bindgen. My question is, if I have a web worker that is running the same WASM blob, will the pointers to functions be the same in each worker?

Pointers to static WASM memory should always be the same if the WASM binary is the same, right?

My intention is to be able to postMessage the pointer from the main thread to the worker to tell it which function to run and to also postMessage the data needed by the function so that I could essentially send any jobs that implement Fn(Box<dyn Any + Serialize + Deserialize>) to the worker thread.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.