On Wed, Jul 23, 2025 at 2:43 AM Stephan Bergmann <[email protected]> wrote:
> On 7/22/25 20:48, 'Sam Clegg' via emscripten-discuss wrote: > > 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. > > unless code gets loaded via WorkerGlobalScope.importScripts (as is e.g. > done at > < > https://git.libreoffice.org/core/+/5dbc995f73da45ad99b95bc3119c75451b2c415d/desktop/source/app/appinit.cxx#78 > >) > I think you could try something like this your JS code right before the call to `importScripts`: `globaThis.Module ||= Module`. Then the imported code would have access to the `Module` object. cheers, sam > > 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 <[email protected] > > <mailto:[email protected]>> 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 [email protected] > > <mailto:emscripten-discuss%[email protected]>. > > To view this discussion visit https://groups.google.com/d/msgid/ > > emscripten-discuss/c7ce1e8e-2f14-4739-a1f2-5598133ad270%40gmail.com > > <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 [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/emscripten-discuss/1f9f3b36-be1c-474a-b266-acce3f2d483e%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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va28ncCNeYGMVcOGGKc6RaXHE-w12AV96XeMVjkFci%3Danng%40mail.gmail.com.
