Boost logo

Boost :

Subject: [boost] Boost.Coroutine
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2010-03-03 03:46:54


I am attempting to use boost.coroutine; however, it is not behaving for me. Perhaps someone could shed some light? Here is what happens:

1 start coroutine A
2 do some work....
    
3 my_wait_for_value()
4 future<R> f(self);
5 callback = make_callback(f);
        
6 r = do_wait( f )
7 boost::coroutines::wait( f ) // blocks and the coroutine exits , goto A
8 return *f;
9 print( "here" )
10 return r;
11 do some more work

A start coroutine B
B do some work
C callback_from_coroutine_A ( R ) // goto line 8
D ....

back to line 8

8 r = *f; // got the right future value
9 print("here")
10 return r;
11 ?????

After returning r on line 10, I should end up back on line 11, but instead end up on line D.

I clearly setup the future, waited, started another coroutine, set the value of the future, returned 2 levels of the stack, but the 3rd level dumped me off back in a different coroutine.

Running on Mac OS X 10.6. Single threaded code.

Dan


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