On Fri, Oct 29, 2021 at 1:49 AM 'Márton Marczell' via emscripten-discuss < [email protected]> wrote:
> > Thank you for the suggestions. My reason for asking is that our code, > although mostly C++, holds on to certain resources only available by > "dropping down" to JS calls, and would like to move them between workers. > We first implemented this on top of the objectTransfer message as seen in > https://github.com/emscripten-core/emscripten/issues/8212, but that was > undocumented, and then it got removed. > > So you want to not only run code on a certain thread but also transfer over JS objects to the target thread? Thats hard in the general case because postMessage messages only occur when a thread yeilds to the event loop, and pthreads don't normally do that. Is there some way you can restructure your application to use native heap objects rather than JS objects? > > On Friday, 29 October 2021 at 01:58:09 UTC+2 [email protected] wrote: > >> We have a message queue system for sending work/functions/message between >> threads. See `emscripten/threading.h`. In particular I think >> `emscripten_dispatch_to_thread` might be useful to you. >> >> Alternatively you can just use the normal C/C++ mechanisms for >> inter-thread communication and do it yourself. All the standard C/C++ API >> for doing this kind of thing should work. >> >> >> On Wed, Oct 20, 2021 at 5:39 AM 'Márton Marczell' via emscripten-discuss < >> [email protected]> wrote: >> >>> Hi, >>> >>> Why is Module.onCustomMessage only available in PROXY_TO_WORKER mode? >>> Would it be possible to enable it in multi-pthreaded applications? We >>> are in need of a solution to do custom messaging between our threads and >>> the main thread. >>> >>> Márton >>> >>> -- >>> 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/87bed389-c756-4bd2-9ab0-5cafcfc756ebn%40googlegroups.com >>> <https://groups.google.com/d/msgid/emscripten-discuss/87bed389-c756-4bd2-9ab0-5cafcfc756ebn%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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/0b541dc0-2ce2-4085-9ab7-1bf4fd5a54c9n%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/0b541dc0-2ce2-4085-9ab7-1bf4fd5a54c9n%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_5v1Y9B5MysF29NLoHNNZHnJWBRVR5UpSAZifsVT84eQ%40mail.gmail.com.
