lua-users home
lua-l archive

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

This is the first and hopefully only annoucement regarding the library on
this mailing-list. ;)

I've polished and published the initial release of cqueues, an embeddable
asynchronous event and sockets library for Lua 5.2 and modern unix family

cqueues leverages modern polling interfaces in tandem with Lua coroutines
to create a simple environment for building asynchronous I/O applications.

It works like this: each instantiated cqueues controller object effectively
represents an epoll, kqueue, or Solaris Ports polling descriptor. You attach
coroutines to the controller, which communicate with the controller through
a simple yield/resume protocol. The coroutine yields one or more objects
which implement 3 optional methods: :pollfd, :events, and :timeout. For each
object the controller installs the requested I/O or timeout event. When an
event fires, the coroutine resumes with those objects which had their event
fired. Basically, just like the way poll(2) works, except it scales because
event persistance is handled automagically.

Because each cqueues object is itself pollable, and because there's no
global state, you can nest cqueues controllers or use the library with
existing event loops. Why would you do this? Because, IMNSHO, cqueues is far
more intuitive, convenient, and because it also comes with the following...

cqueues comes with an example sockets library sporting builtin asynchronous
DNS and SSL/TLS. It supports :setvbuf, :read, and :write according to the
Lua documentation, and in fact works almost exactly like a regular file
handle because you don't need to wait for connection or SSL channel
establishment before beginning to read or write. And much like a stdio
implementation, it can do LF/CRLF translation.

This initial release is known to work on recent Linux, OS X, and Solaris
environments. The only dependencies are Lua 5.2 and OpenSSL; everything else
is internal. The README file contains a rough attempt at compilation, usage,
and API documentation, and a sample script is provided in examples/.

cqueues is fresh software. Please test thoroughly before using in production

[End transmission]