Unless you are using the -s USE_PTHREADS flag, then your application is not mult-threaded. So the browser main thread event loop is driving everything, and there shouldn't be events firing simultaneously. There's only a web worker if you create the worker yourself and instantiate the emscripten module on that worker (and if you do that, there's a completely separate JS/wasm environment that's not shared with the main-thread environment).
On Wed, Oct 2, 2019 at 5:28 AM Simon Sandström <[email protected]> wrote: > Hello, > > I have an application that first creates and setups a WebSocket, like > this: > > ws = emscripten::val::global("WebSocket").new_(emscripten::val(...)); > ws.set("onopen", emscripten::val::module_property("onopen")); > ws.set("onmessage", emscripten::val::module_property("onmessage")); > > and then it sets a main loop with emscripten_set_main_loop(...). > Everything works fine right now as there are no shared resouces between > onopen/onmessage and the code that is run in the main loop, but in the > future it will be. > > Is my application multi-threaded? Can the onopen/onmessage event fire > and execute at the same time as my main loop? Answers online are mostly > old and says that there are no multi-threading in browser JavaScript, > but what about web workers? Are they involved in this scenario? > > > - Simon > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/20191002122818.7pjxllqnqrc3nayz%40simon-laptop > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAAEAhvcySeDkvNTVciY4ytjjqstJJ6r5BDr0mF3XKuyhiT9s7w%40mail.gmail.com.
