Boost logo

Boost :

Subject: Re: [boost] [Coroutine] Back to the caller
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2015-09-17 13:16:01


2015-09-17 13:35 GMT+02:00 Mikhail Strelnikov <mikhail.strelnikov_at_[hidden]>
:

> 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

> Here is the code - http://codepad.org/WGNs0N7F
>

your code line 25 looks strange

coroutine::pull_type default_coroutine = coroutine::pull_type(std::move(
default_coroutine));

Is it a bug of Boost.Coroutine2? If not, how can I change this code to work
> equally for Boost.Coroutine and Boost.Coroutine2?
>

instead of using coroutines I suggest to use class execution_context from
boost.context
(fucntions like symmetric coroutines)

> P.S. What is the reason of boost::coroutines2::coroutine<void>::pull_type
> not having default constructor? It is still possible to have an "empty"
> pull_type, but it is painful process.
>

the constructor requires a function which will be executed in side the
coroutine


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk