]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/coroutine/example/asymmetric/echo.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)
7 #include <boost/coroutine/all.hpp>
12 #include <boost/bind.hpp>
14 typedef boost::coroutines::asymmetric_coroutine
< void >::pull_type pull_coro_t
;
15 typedef boost::coroutines::asymmetric_coroutine
< void >::push_type push_coro_t
;
17 void echo( pull_coro_t
& source
, int i
)
23 void runit( push_coro_t
& sink1
)
25 std::cout
<< "started! ";
26 for ( int i
= 0; i
< 10; ++i
)
28 push_coro_t
sink2( boost::bind( echo
, _1
, i
) );
35 int main( int argc
, char * argv
[])
38 pull_coro_t
source( runit
);
45 std::cout
<< "\nDone" << std::endl
;