[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: coroutine vs threads
- From: Gaspard Bucher <gaspard@...>
- Date: Sat, 16 Jul 2011 14:41:45 +0200
Hi there,
I read somewhere that the Lua-av team received advice from the Lua core team to use coroutines in their multimedia project to emulate multi-threading. I am wondering if the same advice would hold in the given scenario:
The Lua state processes a single operation at a time (no concurrency). Example of such operations (for the same Lua state) can be:
1. Receive message from network ===> update state ==> post reply
2. Receive notification from OS (file changed, mdns discovery, etc)
3. Receive a command from GUI (redraw window, mouse event, keyboard event, etc)
4. Trigger function from scheduler (pthread based timer)