[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: coroutine vs threads
- From: Wesley Smith <wesley.hoke@...>
- Date: Sat, 16 Jul 2011 11:34:29 -0500
Just to clarify, I don't think we received direct advice from the Lua team, but we subscribe to the Lua team's understanding that multithreading and determinancy don't go hand in hand and we wanted to make scripts written for LuaAV be exactly determined (strictly timed). Coroutines are not used to simulate multithreading per se, but to provide a means to compose concurrent temporal processes. Of course everything is executed serially in the end.
Thanks!
wes
On Jul 16, 2011, at 7:41 AM, Gaspard Bucher <gaspard@teti.ch> wrote:
> 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)
>
>
> Gaspard
>