]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/coroutine/example/symmetric/simple.cpp
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)
10 #include <boost/bind.hpp>
11 #include <boost/coroutine/all.hpp>
13 typedef boost::coroutines::symmetric_coroutine
< void > coro_t
;
15 coro_t::call_type
* c1
= 0;
16 coro_t::call_type
* c2
= 0;
18 void foo( coro_t::yield_type
& yield
)
20 std::cout
<< "foo1" << std::endl
;
22 std::cout
<< "foo2" << std::endl
;
24 std::cout
<< "foo3" << std::endl
;
27 void bar( coro_t::yield_type
& yield
)
29 std::cout
<< "bar1" << std::endl
;
31 std::cout
<< "bar2" << std::endl
;
33 std::cout
<< "bar3" << std::endl
;
36 int main( int argc
, char * argv
[])
38 coro_t::call_type
coro1( foo
);
39 coro_t::call_type
coro2( bar
);
43 std::cout
<< "Done" << std::endl
;