#include #include int main() { auto say = [](const T& t) { std::cout << "[" << boost::this_fiber::get_id() << "]: " << t << std::endl; }; say("cogito,"); boost::fibers::fiber f1(say, "sum"); say("ergo"); boost::fibers::fiber f2([&] { for(auto i : {1, 2, 3}) { say(i); boost::this_fiber::yield(); } }); f2.join(); boost::fibers::fiber f3([&] { for(auto c : {'a', 'b', 'c'}) { say(c); boost::this_fiber::yield(); } }); boost::fibers::fiber f4([&] { for(auto c : {'x', 'y', 'z'}) { say(c); boost::this_fiber::yield(); } }); say("bye"); f1.join(); f3.join(); f4.join(); }