[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: attempt to yield across metamethod/C-call boundary
- From: gary ng <garyng2000@...>
- Date: Sat, 3 May 2008 23:35:26 -0700 (PDT)
Hi,
I sort of understand the C-call limitation but is not
quite sure about the metamethod one.
I am trying to work on making the socket.http(in
luasocket) module becomes async(COPAS) capable and
encounter this error.
And I am pretty sure there is no C-call involved in
the yield chain but there is some metamethod involve.
Kind of in the following chain :
function http:sendheader()
header = 'whatever header'
self.sock:send(header)
end
function co1()
http:send()
end
function co2()
sock:send()
end
resume(co1) -- error
resume(co2) -- doing fine
here http is an object which handles the HTTP protocol
and store the underlying socket object(where the
send/receive is COPAS wrapped)
I can work around this using luajit or COCO patch but
just wondering why introducing one level of
indirection like the above breaks the whole coroutine
thing.
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ