[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strange experiences with coroutines while using Copas
- From: Javier Guerra <javier@...>
- Date: Sun, 21 Aug 2005 12:12:39 -0500
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
--
Javier
Attachment:
pgpFgk6lfyXRd.pgp
Description: PGP signature