|
Boost : |
Subject: Re: [boost] [Coroutine] Back to the caller
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2015-09-18 02:48:34
2015-09-18 6:26 GMT+02:00 Mikhail Strelnikov <mikhail.strelnikov_at_[hidden]>:
> 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?
>
Without 'yield()' in line 30 the parent coroutine terminates/is complete
(e.g. it
leaves your lambda after line 31). Leaving the lambda of the parent
coroutine
issues a jump back so you return from 'start_parent_coroutine()'.
Line 39 calls the child coroutine.
'yield();' at line 16 (inside the child coroutine) triggers a context
switch to the parent
coroutine which is already complete. That is because the child coroutine is
created inside the parent coroutine and thus the calling context is the
stack of the
parent coroutine.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk