2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-10 23:32:28 +00:00
Files
fiber/examples/test_fiber.cpp
Oliver Kowalke 2f19be6d67 use C++11
2014-12-27 19:07:42 +01:00

24 lines
402 B
C++

#include <string>
#include <boost/bind.hpp>
#include <boost/fiber/all.hpp>
void foo( std::string const& str, int n)
{
for ( int i = 0; i < n; ++i)
{
std::cout << i << ": " << str << std::endl;
boost::this_fiber::yield();
}
}
void bar()
{
boost::fibers::fiber f1( boost::bind( foo, "abc", 5) );
boost::fibers::fiber f2( boost::bind( foo, "xyz", 7) );
f1.join();
f2.join();
}