]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/coroutine/example/asymmetric/echo.cpp
9f1e2cb7a1303aa9403dcffac752900f87ca0ca2
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::asymmetric_coroutine
< void >::pull_type pull_coro_t
;
14 typedef boost::coroutines::asymmetric_coroutine
< void >::push_type push_coro_t
;
16 void echo( pull_coro_t
& source
, int i
)
22 void runit( push_coro_t
& sink1
)
24 std::cout
<< "started! ";
25 for ( int i
= 0; i
< 10; ++i
)
27 push_coro_t
sink2( boost::bind( echo
, _1
, i
) );
34 int main( int argc
, char * argv
[])
37 pull_coro_t
source( runit
);
44 std::cout
<< "\nDone" << std::endl
;