1 #include <boost/coroutine/all.hpp>
6 #include <boost/bind.hpp>
10 typedef boost::coroutines::asymmetric_coroutine< X& >::pull_type pull_coro_t;
11 typedef boost::coroutines::asymmetric_coroutine< X& >::push_type push_coro_t;
13 void fn1( push_coro_t & sink)
15 for ( int i = 0; i < 10; ++i)
22 void fn2( pull_coro_t & source)
26 std::cout << "i = " << x.i << std::endl;
31 int main( int argc, char * argv[])
34 pull_coro_t source( fn1);
37 std::cout << "i = " << x.i << std::endl;
42 push_coro_t sink( fn2);
43 for ( int i = 0; i < 10; ++i)
49 std::cout << "Done" << std::endl;