lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Sun, Jul 17, 2011 at 2:36 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
* Gaspard Bucher:

> Thanks for the feedback Florian. I needed some reassurance: global mutex are
> so out of fashion nowadays that I felt I must be stupid or misunderstanding
> something important for deciding to use one. If we want to handle multiple
> event sources, there must be some kind of gate between these sources and the
> Lua state and the simplest of such gates is a mutex, right ?

Usually, there's a single centralized even loop and no threads and
mutexes.  The event loop notices when file descriptors become active,
distributes signals, and provides timers, too.  The choice of event
loop is typically fixed by the choice of GUI library.


I do not think I could use your suggestion of a centralized event loop. What happens with zmq requests for example ? These are synchronous calls that cannot easily be "posted" as events. I will investigate further to see how I could integrate things like "mdns", "zmq" and Qt in a single event loop: a single "select" without mutex seems like the obvious choice but I'm not sure I can force ZeroConf and ZeroMQ into Qt slavery.

Gaspard



--

                                                               Gaspard