Continuation Queues: Embeddable asynchronous networking, threading, and notification framework for Lua on Unix.
$ luarocks install cqueues
cqueues is a type of event loop for Lua, except it's not a classic event loop. It doesn't use callbacks—neither as part of the API nor internally—but instead you communicate with an event controller by the yielding and resumption of Lua coroutines using objects that adhere to a simple interface.
cqueues are also stackable. Each instantiated cqueue is a pollable object which can be polled from another cqueue, or another event loop system entirely. The design is meant to be unintrusive, composable, and embeddable within existing applications—such as Apache or Nginx—or used standalone. It maintains no global state and never blocks your thread of execution.
cqueues includes a sockets library with DNS, buffering, end-of-line translation, SSL/TLS, and descriptor passing support builtin. Domain querying, connection establishment, and SSL negotiation are handled transparently as part of a state machine entered with every I/O operation, so users can read and write immediately upon instantiating the object, as if opening a regular file.
cqueues also includes modules for handling signals, threads, and file change notifications using native kernel facilities—such as signalfd on Linux, or Solaris PORT_SOURCE_FILE for file events—and accessible through easy to use interfaces which abstract the different kernel facilities.
Additional modules include a light-weight user-defined event system using the condition variable pattern, and a comprehensive interface for DNS querying.