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 struct X : private boost::noncopyable
16 X() { std::cout << "X()" << std::endl; }
17 ~X() { std::cout << "~X()" << std::endl; }
20 typedef boost::coroutines::symmetric_coroutine< void > coro_t;
22 coro_t::call_type * c1 = 0;
23 coro_t::call_type * c2 = 0;
25 void foo( coro_t::yield_type & yield)
28 std::cout << "foo() entered" << std::endl;
31 std::cout << "foo() finished" << std::endl;
34 void bar( coro_t::yield_type & yield)
36 std::cout << "bar() entered" << std::endl;
38 std::cout << "bar() finished" << std::endl;
41 int main( int argc, char * argv[])
43 coro_t::call_type coro1( foo);
44 coro_t::call_type coro2( bar);
48 std::cout << "Done" << std::endl;