lua-users home
lua-l archive

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


Just wondering, how does a LibEvent binding into Lua sound?  Right now
it seems to be a good option/addition to the HelperThreads library for
my MoonLog application (syslog/metalog replacement).

Basically you set up file descriptor events that LibEvent will watch
for (such as socket readiness, file has data available, etc... using
the 'best' method available, be it EPoll, kqueue, /dev/poll, poll,...)
and will dispatch event handlers for you... However you must run a
dispatch loop of sorts (either theirs or roll-your-own).

Does anyone have any idea of a good interface to Lua?  For
HelperThreads, are there any ideas on how to best merge these
together... since basically there has to be a merged interface... or a
combined dispatch loop (alternating between HelperThreads waiting and
LibEvent waiting).

... Another idea I thought of at this later hour is to have
HelperThreads be the core... and setup a task/thread as the LibEvent
dispatch loop... and whenever there's events, either signal_task and
wait, or queue up the data in a threadsafe queue and
signal_task(0).  When the update handler gets called, the queue gets
transferred somehow (either by returning an object w/ a CClosure that
can access the latest queue objects and then free the data via __gc
and/or :free())

-- 
Thomas Harning Jr.
Fortune:
	Against his wishes, a math teacher's classroom was remodeled.
Ever since, he's been talking about the good old dais.  His students
planted a small orchard in his honor; the trees all have square roots.

Attachment: signature.asc
Description: PGP signature