Blocking messages in workers

25 views
Skip to first unread message

Marc Nieper-Wißkirchen

unread,
Feb 13, 2015, 3:01:46 AM2/13/15
to emscripte...@googlegroups.com
In

https://github.com/kripken/emscripten/wiki/Asyncify

at the very end, it is mentioned that one way to handle code that needs to be asynchronous on the Javascript side is to use blocking messages in workers.

This intrigues me: Can one block a web worker synchronously?

--

Marc

Alon Zakai

unread,
Feb 14, 2015, 4:47:17 PM2/14/15
to emscripte...@googlegroups.com
No, workers cannot block. There have been suggestions for such APIs, for example from me ;) , but I don't think there is much interest in the standards bodies for such a thing. Perhaps it's for the best, I'm not sure.

See btw the Emterpreter for another way to simulate synchronous code https://github.com/kripken/emscripten/wiki/Emterpreter

- Alon


--
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-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marc Nieper-Wißkirchen

unread,
Feb 14, 2015, 5:06:52 PM2/14/15
to emscripte...@googlegroups.com
What a pity! i was hoping to learn a way how to bliock workers - as it would bring Emscripten in worker contexts much more to the synchronous C model.

I agree that simply allowing blocking calls e.g. for receiving a new message would raise problems - what if another event comes in at the same time. But mutexes or locks could work.

Anyway, when ES6 proper tail calls come and asm,js learns to support them, Emscripten could possibly rewrite everything in continuation passing style so saving the continuation would pose no problem anymore.

--

Marc

--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/iCVonEMlLPo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages