2 // Copyright Oliver Kowalke 2009.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/coroutine/all.hpp>
12 #include <boost/bind.hpp>
14 void first( boost::coroutines::asymmetric_coroutine< void >::push_type & sink)
16 std::cout << "started first! ";
17 for ( int i = 0; i < 10; ++i)
20 std::cout << "a" << i;
24 void second( boost::coroutines::asymmetric_coroutine< void >::push_type & sink)
26 std::cout << "started second! ";
27 for ( int i = 0; i < 10; ++i)
30 std::cout << "b" << i;
34 int main( int argc, char * argv[])
37 boost::coroutines::asymmetric_coroutine< void >::pull_type source1( boost::bind( first, _1) );
38 boost::coroutines::asymmetric_coroutine< void >::pull_type source2( boost::bind( second, _1) );
39 while ( source1 && source2) {
47 std::cout << "\nDone" << std::endl;