Hi, I tried to build with threads, but I get this error in Chrome: "Uncaught ReferenceError: SharedArrayBuffer is not defined".
It seems that there's no support in Chrome? Does that mean that Emscripten can't run with USE_PTHREADS in Chrome? And so the MAIN_THREAD_* functionality is unavailable? Kind regards, Ilya Kantor > On 9 Feb 2023, at 19:51, 'Thomas Lively' via emscripten-discuss > <emscripten-discuss@googlegroups.com> wrote: > > > 1) The "main thread" is the main browser page thread that loaded WASM > > webworker, the one with the "window" object. It has access to DOM etc. So > > we can use it to work from DOM from C. > > This is correct. There is a "proxying" system in Emscripten's system > libraries that handles sending work between threads, but ultimately it is > implemented on top of postMessage. I'm not sure how you looked for > postMessage calls, but if you build with pthreads enabled, they should be in > there somewhere. > > On Thu, Feb 9, 2023 at 2:18 AM Ilya Kantor <ilia...@gmail.com > <mailto:ilia...@gmail.com>> wrote: >> Hello, >> >> I'm reading the docs and getting confused, what the "Main thread" is? >> >> Sometimes it's referred to as the "Main browser thread", the term appears in >> macroses such as MAIN_THREAD_EM_ASM. >> >> I see two possible explanations there, please tell me which one is correct? >> >> 1) The "main thread" is the main browser page thread that loaded WASM >> webworker, the one with the "window" object. It has access to DOM etc. So we >> can use it to work from DOM from C. >> >> It appears so from the page: >> https://emscripten.org/docs/api_reference/emscripten.h.html?highlight=main_thread_async_em_asm#c.MAIN_THREAD_EM_ASM >> >> But it doesn't work for me like that, and I don't see any `postMessage` >> calls in JS, how does Emscripten implement the interaction with the main >> page? >> >> 2) The "main thread" is related to pthread usage: it's the all-parenting >> pthread, when we have multiple pthreads running. Otherwise, if we're not >> using pthreads, then it's irrelevant, the main thread is the only thread >> anyway. >> >> In other words, the "main thread" is a pure pthreads concept, the >> all-parenting thread. >> >> 3) ...Can it be sometimes 1) and sometimes 2)? =) >> >> Please help me to figure out. >> >> Thank you! >> >> Kind regards, >> Ilya Kantor >> >> -- >> 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 >> <mailto:emscripten-discuss+unsubscr...@googlegroups.com>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/029031da-a7f9-47dc-8db0-91a52672e9aan%40googlegroups.com >> >> <https://groups.google.com/d/msgid/emscripten-discuss/029031da-a7f9-47dc-8db0-91a52672e9aan%40googlegroups.com?utm_medium=email&utm_source=footer>. > > > -- > 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 > <mailto:emscripten-discuss+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EURcypJTd8ONp4JAPAqz06QU5NSfKroDjgpG6FGqhcVEQ%40mail.gmail.com > > <https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EURcypJTd8ONp4JAPAqz06QU5NSfKroDjgpG6FGqhcVEQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- 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 on the web visit https://groups.google.com/d/msgid/emscripten-discuss/537F9081-3D1A-45DB-920B-127373CE1451%40gmail.com.