lua-users home
lua-l archive

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


On Friday 27 January 2006 1:39 am, PA wrote:
> Talking of which, whatever happened to Mike's "Event API" draft?
>
> http://lua-users.org/files/wiki_insecure/users/MikePall/event.html

that's nice, i haven't seen it.

the one thing i don't like (yet) is that having different types of events 
seems to make it harder to extend by library writers.

also, making POSIX files and windows events different things opens a huge door 
to platform dependency.

what i've been thinking would show a Lua API much like this; but also a well 
defined C API, so that anybody could write a new library that directly plugs 
into this one.

also, what if i'm writing a Lua interface for a C library that has only 
blocking calls?

i think the easiest (for the library writers) would be to add an event type 
that takes a function pointer (and a private data pointer?) and executes it 
in a background thread.  when finished, the event is raised.  again, it 
should be clearly specified that these background functions shouldn't use 
lualib.

in a first try, a new thread is created each time; but after that is working, 
a thread pool could be implemented without any API change.

also, i think the convention for Lua libraries should be that the user 
shouldn't use ev:add(), instead, any new nonblocking function should take an 
event container as a parameter and return an event id.

-- 
Javier

Attachment: pgpaQaOE4lsL8.pgp
Description: PGP signature