mirror of
https://github.com/boostorg/coroutine.git
synced 2026-01-30 07:42:52 +00:00
remove pull/push_coroutine_object classes
This commit is contained in:
@@ -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
|
||||
;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user