Yes, the "module" object in this case is internal to the thread only. No code other than emscripten-generted code ever runs in a pthread worker so hopefully there is no external code that might need it.
All internal code such as EM_ASM and js-library functions all run in the module scope so have access to all the module instance internals already. Anything you would access have `MyModule.foo` can be accessed simply via `foo` in internal code (this goes for single threaded code too). cheers, sam On Thu, Jul 17, 2025 at 7:37 AM Stephan Bergmann <sberg....@gmail.com> wrote: > When I use -sMODULARIZE and -pthread, code gets generated into the *.js > file so that the pthread workers do > > > isPthread && Module(); > > (where the Module() invocation returns a promise that resolves to a > module instance). But that module instance is effectively "lost", or is > there some way for me to obtain it? (Other than using sed on the > generated *.js to make that line instead read > > > isPthread && createOnlineModule().then(module => ...); > > and capture the instance.) > > -- > 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 emscripten-discuss+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/emscripten-discuss/c7ce1e8e-2f14-4739-a1f2-5598133ad270%40gmail.com > . > -- 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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-1T3nSKO2e%2B6C6a83nOO7hmZpkJyT9Ls9Qq%3D9gfRQKzg%40mail.gmail.com.