lua-users home
lua-l archive

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


My current preferred design for such things is to create a userdata
with the event queues and have lua poll it and dispatch.

You can, then, better control access from your threads to this queue.

--
Luís Eduardo Jason Santos
From: Egil Hjelmeland
Sent: 3/27/2012 9:24
To: Lua mailing list
Subject: Re: Options for Asynchronous Callbacks
Den 2012-03-27 13:15, skrev steve donovan:
> On Tue, Mar 27, 2012 at 1:02 PM, Javier Guerra Giraldez
> <javier@guerrag.com>  wrote:
>> either you use different states, or make sure no two threads run it at
>> the same time.
> That's the approach I've been taking, by using a mutex to ensure that
> only one callback can run at a time. But simple print statements are
> blowing up, unfortunately, even with these locks.  What does work is
> if the main thread is sleeping all the time, and then the callbacks
> behave fine.
>

Could it be that your print statements are non-threadsafe ?

Egil