lua-users home
lua-l archive

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


Hi,

Diego already mentioned it on the list that a new event API for Luasocket
is in the works. It is destined to replace the ugly socket.select() API
and abstract it from any particular OS-specific event multiplexing call.

So now is the time to discuss this with the list. This is just a first
draft of a spec. Any and all comments are welcome.

Here is the link to the documentation and a short abstract:

http://lua-users.org/files/wiki_insecure/users/MikePall/event.html


The main features of the new Event API are:

* A unified event model for various kinds of event types and event sources
  (such as sockets or timers).

* A registry-based approach allows for efficient management of the event
  list both by applications and by the event mechanism.

* Triggered events can be fetched with a passive iterator. Any kind of
  dispatching mechanism can be adapted to work on top of this API.

* A common internal API for the OS-specific backends.


Please, anyone interested in this kind of API read the document and
give us feedback. Diego and I will gladly discuss this with you here
on the list. Thank you!

I have implemented quite a bit of it previously, but the code is not ready
for release yet. I have to untangle it first from other code that
intermixes it with a specific dispatcher. Also all of the code may still
change depending on your feedback. E.g. I'm not sure whether I really
need to store and return associated objects (but it's rather convenient).

BTW: Yes, I know there are already several event dispatcher libraries
     out there. However none of them fit the bill. Either due to
     copyright reasons or because the API does not mix nicely with Lua
     or they are just plain bloated.

Bye,
     Mike