coroutine: activate new interface V2

[SVN r84428]
This commit is contained in:
Oliver Kowalke
2013-05-22 20:15:43 +00:00
parent bcae158775
commit ce1270c353
25 changed files with 5903 additions and 179 deletions

View File

@@ -10,6 +10,40 @@
#include <boost/bind.hpp>
#include <boost/coroutine/all.hpp>
#ifdef BOOST_COROUTINES_V2
struct X : private boost::noncopyable
{
X() { std::cout << "X()" << std::endl; }
~X() { std::cout << "~X()" << std::endl; }
};
void fn( boost::coroutines::push_coroutine< void > & c)
{
X x;
int i = 0;
while ( true)
{
std::cout << "fn() : " << ++i << std::endl;
c();
}
}
int main( int argc, char * argv[])
{
{
boost::coroutines::pull_coroutine< void > c( fn);
for ( int k = 0; k < 3; ++k)
{
c();
}
std::cout << "destroying coroutine and unwinding stack" << std::endl;
}
std::cout << "\nDone" << std::endl;
return EXIT_SUCCESS;
}
#else
typedef boost::coroutines::coroutine< void() > coro_t;
struct X : private boost::noncopyable
@@ -44,3 +78,4 @@ int main( int argc, char * argv[])
return EXIT_SUCCESS;
}
#endif