lua-users home
lua-l archive

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


On Sun, Dec 20, 2009 at 4:34 AM, Wim Couwenberg
<wim.couwenberg@gmail.com> wrote:
>> This patch uses static globals, so isn't thread safe, but since the
>> libevent event_dispatch() API isn't thread-safe either, that shouldn't
>> be a problem.
>
> Instead of a static global you could store the dispatching state in a
> (not light) userdata in the registry.  Then it is accessible form all
> Lua states (where events are created) and its address is fixed.

It's not clear to me exactly what you mean. This may or may not work
depending on how void handler() is written. I'll be interested in
seeing the patch, if you ever do it.

Anyhow, I'm not using libevent, I'm just reading the book to broaden
my exposure to lua idioms, and noticed that the code as written had
this subtle bug.

Cheers,
Sam