mirror of
https://github.com/boostorg/coroutine.git
synced 2026-02-08 22:53:00 +00:00
add test regarding to multiple definition
This commit is contained in:
@@ -60,6 +60,7 @@ exe segmented_stack
|
||||
;
|
||||
exe simple
|
||||
: simple.cpp
|
||||
test.cpp
|
||||
;
|
||||
exe unwind
|
||||
: unwind.cpp
|
||||
|
||||
32
example/cpp03/asymmetric/test.cpp
Normal file
32
example/cpp03/asymmetric/test.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <boost/coroutine/all.hpp>
|
||||
|
||||
typedef boost::coroutines::asymmetric_coroutine< void >::pull_type pull_coro_t;
|
||||
typedef boost::coroutines::asymmetric_coroutine< void >::push_type push_coro_t;
|
||||
|
||||
void foo1( push_coro_t & sink)
|
||||
{
|
||||
for ( int i = 0; i < 10; ++i)
|
||||
sink();
|
||||
}
|
||||
|
||||
void foo2( pull_coro_t & source)
|
||||
{
|
||||
while ( source)
|
||||
source();
|
||||
}
|
||||
|
||||
void bar()
|
||||
{
|
||||
{
|
||||
pull_coro_t source( foo1);
|
||||
while ( source) {
|
||||
source();
|
||||
}
|
||||
}
|
||||
{
|
||||
push_coro_t sink( foo2);
|
||||
for ( int i = 0; i < 10; ++i)
|
||||
sink();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user