I think the solution is to use the `emscripten_sync_run_in_main_runtime_thread` family of functions. I've opened a PR to remove the (as you point out, currently unusable/broken) `emscripten_sync_run_in_main_thread` family.
On Mon, Jan 23, 2023 at 8:14 AM 'Thomas Lively' via emscripten-discuss < emscripten-discuss@googlegroups.com> wrote: > It looks like there was some unintentional breakage of > `emscripten_sync_run_in_main_thread` in December. I left a comment on the > relevant PR: > https://github.com/emscripten-core/emscripten/pull/15756#issuecomment-1400603196 > . > > That being said, the best way to send work to other threads these days is > using the proxy queue mechanism in proxying.h > <https://emscripten.org/docs/api_reference/proxying.h.html>. These new > APIs are safer to use to proxy nontrivial work, give you more control over > when work is executed, and give you more control over how you wait for the > work to be done. FWIW, the older `emscripetn_async_run_in_main_thread` and > other proxying APIs in threading.h have been internally reimplemented in > terms of proxying.h as well. > > On Sat, Jan 21, 2023 at 5:16 PM Mark Sibly <marksi...@gmail.com> wrote: > >> I've been using emscripten_async_run_in_main_runtime_thread for 6 months >> or so now and it works great for me. >> >> I do feel this stuff needs to be better docced, emscripten.org has >> nothing about threading in the API reference section, I feel like there >> should at least be a 'threading.h' page in there? There's some useful stuff >> in 'Wasm Workers API' (that's where searching for >> emscripten_async_run_in_main_runtime_thread takes me) although I've need >> used a 'Wasm Worker' so this feels like the wrong place to be looking for >> info on threading. >> >> Bye! >> Mark >> >> -- >> 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/3b303b63-4008-49f0-bb8b-f48a8c0b294fn%40googlegroups.com >> <https://groups.google.com/d/msgid/emscripten-discuss/3b303b63-4008-49f0-bb8b-f48a8c0b294fn%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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EUaJ%2BWiBT2abCVscMm5WXAGJ35g8jk8p1qOobiGF%3DjKJw%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EUaJ%2BWiBT2abCVscMm5WXAGJ35g8jk8p1qOobiGF%3DjKJw%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/CAL_va29XkXd_2bW_ZAnREApOiCctw88qyG%3DpX2%3DvRO1WxE9qxA%40mail.gmail.com.