lua-users home
lua-l archive

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


On Fri, Sep 30, 2011 at 12:29 PM, Duncan Cross <duncan.cross@gmail.com> wrote:
> Look at Copas [1] for a coroutine-based version of this.

A very clear explanation of the approach is in PiL

http://www.lua.org/pil/9.4.html

The key thing to understand is that the listening socket is not
blocking, it's just on a short timeout. Copas uses that timeout to
schedule the coroutines and resume listening.  So it is not 'true'
multithreading but works well enough.

steve d.