[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaSocket - COPAS - CoSocket
- From: Diego Nehab <diego@...>
- Date: Fri, 11 May 2007 13:03:50 -0400 (EDT)
On Fri, 11 May 2007, email@example.com wrote:
socket.http uses a function called protect(), which uses
pcall. There is a sample pair in the LuaSocket distribution
that works around this problem by redefining protect(). Take
a look at dispatch.lua and check-links.lua. Not sure how
this would interact with COPAS, but might be worth it a try.
It doesn't look like it will work with COPAS. COPAS receive and send will
yield, if the I/O would block and the yield assumes it's returning values
to the COPAS scheduler. If you wrap a LuaSocket with coxpcall, coxpcall
will probably catch errors, but will also end up getting the yields from
the COPAS functions. At least this is how I see it now, based on my
limited understanding of how the coroutine-based xpcall is supposed to
Did you take a look at dispatch.lua and check-links.lua?
That's exactly what they do. dispatch.lua is very similar to
COPAS. check-links.lua has a mode on which everything is
non-blocking. dispatch.lua replaces the send() and receive()
to yield too.