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