remove pull/push_coroutine_object classes

This commit is contained in:
Oliver Kowalke
2014-01-29 16:59:19 +01:00
parent d5e8413b5d
commit 0223e75a70
16 changed files with 572 additions and 1681 deletions

View File

@@ -20,7 +20,11 @@ project boost/coroutine/example
<library>/boost/program_options//boost_program_options
<library>/boost/thread//boost_thread
<toolset>gcc-4.7,<segmented-stacks>on:<cxxflags>-fsplit-stack
<toolset>gcc-4.7,<segmented-stacks>on:<cxxflags>-DBOOST_USE_SEGMENTED_STACKS
<toolset>gcc-4.8,<segmented-stacks>on:<cxxflags>-fsplit-stack
<toolset>gcc-4.8,<segmented-stacks>on:<cxxflags>-DBOOST_USE_SEGMENTED_STACKS
<toolset>gcc-4.9,<segmented-stacks>on:<cxxflags>-fsplit-stack
<toolset>gcc-4.9,<segmented-stacks>on:<cxxflags>-DBOOST_USE_SEGMENTED_STACKS
<link>static
<threading>multi
;

View File

@@ -19,21 +19,23 @@ struct X
{}
};
typedef boost::coroutines::coroutine< void >::pull_type pull_coro_t;
typedef boost::coroutines::coroutine< void >::push_type push_coro_t;
typedef boost::coroutines::coroutine< X& >::pull_type pull_coro_t;
typedef boost::coroutines::coroutine< X& >::push_type push_coro_t;
void fn1( push_coro_t & sink)
{
for ( int i = 0; i < 10; ++i)
{
sink();
X x( i);
sink( x);
}
}
void fn2( pull_coro_t & source)
{
while ( source) {
std::cout << "i = " << std::endl;
X & x = source.get();
std::cout << "i = " << x.i << std::endl;
source();
}
}
@@ -43,8 +45,8 @@ int main( int argc, char * argv[])
{
pull_coro_t source( fn1);
while ( source) {
// X * x = source.get();
std::cout << "i = " << std::endl;
X & x = source.get();
std::cout << "i = " << x.i << std::endl;
source();
}
}
@@ -52,7 +54,8 @@ int main( int argc, char * argv[])
push_coro_t sink( fn2);
for ( int i = 0; i < 10; ++i)
{
sink();
X x( i);
sink( x);
}
}
std::cout << "Done" << std::endl;