lua-users home
lua-l archive

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

On Sunday 21 August 2005 2:50 am, Chris Pressey wrote:
> Am I right in guessing that it's not recommended to use coroutines in
> code that is running under copas.addserver()?

i don't think so.  i've sometimes tried some weird 'coroutines within 
coroutines' yielded at several levels with mostly expected results.  for 
example, in Xavante the main dispatcher is a coroutine-based iterator.

granted, it doesn't yield out of the 'thread' by doing IO while iterating... 
but some other experiments have been fairly predictable (even if ugly and 
replaced by easier layerings of code)

if you make sure which resume() is paired with each yield(), it should work.

i haven't tried your code, it 'feels' right to me; but the last point, where 
changing a 'for' with a 'while' changes the failure mode makes me think the 
problem is somewhere else, and the yield-resume mixup is just a symptom


Attachment: pgpAW7A1aInwl.pgp
Description: PGP signature