[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to make a callback based socket interface?
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 30 Sep 2011 12:35:46 +0200
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.