You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue I've run into is that __wbindgen_start is called whenever init is called. So the binary's main is invoked extra times whenever the library tries to spawn a worker and call init for it.
Is there some way to disable the automatic call to __wbindgen_start so that it can be invoked only for the main thread? Or should a special init be introduced for web workers?
Additional Details
Work arounds:
Require the binary using the library to insert some sort of check into main to detect that they're on a worker thread.
Compile the binary as a lib and manually invoke start
The text was updated successfully, but these errors were encountered:
Currently this can't be done, you'll need to orchestrate something without the start function. The way multithreading works is to create an instance on each thread, which inherently runs the start function.
@alexcrichton would it be acceptable to add a function like initWithoutStart? Basically a copy of init but without the call to __wbindgen_start() at the end. Or is there some other reason/limitation why this isn't possible?
Summary
For context: I've been experimenting with creating a library that spawns web workers that share memory with each other and the main thread.
I've been basing my experiments off of the Raytrace Parallel example: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/raytrace-parallel
An issue I've run into is that
__wbindgen_start
is called wheneverinit
is called. So the binary'smain
is invoked extra times whenever the library tries to spawn a worker and callinit
for it.Is there some way to disable the automatic call to
__wbindgen_start
so that it can be invoked only for the main thread? Or should a specialinit
be introduced for web workers?Additional Details
Work arounds:
lib
and manually invokestart
The text was updated successfully, but these errors were encountered: