|
Boost : |
Subject: Re: [boost] [Coroutine] Back to the caller
From: Mikhail Strelnikov (mikhail.strelnikov_at_[hidden])
Date: 2015-09-18 00:26:46
Oliver, thank you for your answer, it is very helpful.
> > I have an issue after switching from Boost.Coroutine to Boost.Coroutine2 -
> > nested coroutine switches to its creator - not to the caller.
> >
>
> this is not how asymmetric coroutines are defined - a asymmetric coroutine
> has to return to its
> resumption point while suspended
Okay. But where "resumption point" belongs to? To the caller or to the creator?
Sorry for posting such a long code, I think now I've simplified it -
http://codepad.org/yRqRfQBI
Output:
When using Boost.Coroutine result is 122
When using Boost.Coroutine2 result is 1221
So there is one template test<> instantiated twice (with
coroutines::coroutine<void> and coroutines2::coroutine<void>) results
in two different outputs "122" and "1221". This "122" makes perfect
sense.
Why calling 2nd coroutine leads to calling 1st in case of
Boost.Coroutine2? What is motivation for this?
Now if you'll comment line 30 containing "yield();" it will still work
for Boost.Coroutine but crash on assert for Boost.Coroutine2. This
means inner coroutine shoud have less steps than outer coroutine. What
is motivation behind that?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk