pull_coroutine< void > - ctor changes

This commit is contained in:
Oliver Kowalke
2014-01-23 19:45:37 +01:00
parent b39c82b4ca
commit 8857a31281
4 changed files with 71 additions and 64 deletions

View File

@@ -14,21 +14,6 @@ import modules ;
import os ;
import toolset ;
if [ os.name ] = SOLARIS
{
lib socket ;
lib nsl ;
}
else if [ os.name ] = NT
{
lib ws2_32 ;
lib mswsock ;
}
else if [ os.name ] = HPUX
{
lib ipv6 ;
}
project boost/coroutine/example
: requirements
<library>../../build//boost_coroutine
@@ -40,42 +25,6 @@ project boost/coroutine/example
<threading>multi
;
exe segmented_stack
: segmented_stack.cpp
;
exe fibonacci
: fibonacci.cpp
;
exe echo
: echo.cpp
;
exe power
: power.cpp
;
exe parallel
: parallel.cpp
;
exe unwind
: unwind.cpp
;
exe same_fringe
: same_fringe.cpp
;
exe layout
: layout.cpp
;
exe chaining
: chaining.cpp
;
exe exception
: exception.cpp
exe simple
: simple.cpp
;

37
example/cpp03/simple.cpp Normal file
View File

@@ -0,0 +1,37 @@
// Copyright Oliver Kowalke 2009.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <cstdlib>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/coroutine/all.hpp>
typedef boost::coroutines::coroutine< void >::pull_type pull_coro_t;
typedef boost::coroutines::coroutine< void >::push_type push_coro_t;
void runit( push_coro_t & sink)
{
std::cout << "started! ";
for ( int i = 0; i < 10; ++i)
{
sink();
}
}
int main( int argc, char * argv[])
{
{
pull_coro_t source( runit);
while ( source) {
source();
}
}
std::cout << "\nDone" << std::endl;
return EXIT_SUCCESS;
}