Boost logo

Boost :

Subject: Re: [boost] [coroutine] interface suggestion
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-09-20 07:05:13

> - Why do you need to explicitly bind? If you are required to bind the
> arguments of the coroutine-fn anyway, the trampoline might as well do it
> for you.

bind() in the sense to get the address. with the address I can store new values in the variable.

> - As you described, you need to provide an alternate interface (i.e.
> get())

get() should not be provided

> - Tying the caller_t to an object in the coroutine stack (the parameters),
> makes it very hard to move the caller object to another coroutine. This is
> important to implement pipelines, where yield does not return to the
> caller
> but the next coroutine in the pipeline.

let us keep the library simple - chains of coroutiens will causes many problems

> How would you exactly rebind references?

references are pointers == addresses - in the case I get the address of the pointer and store tat this place the address of the new value

> int i = 0, j = 0;
> coroutine<void(int&)> coro([&](caller_t& caller, int& x) {
> caller.bind(x);
> assert(&x == &i); // ok
> caller.yield();
> assert(&x == &y); // ?????
> });
> coro(i);
> coro(j);

caller.bind(x); // get address of the reference of x which contains the address of i
caller.yield(); // in this call I store the address of j at the address of reference of x.


Boost list run by bdawes at, gregod at, cpdaniel at, john at