#include #include using namespace alsk::arg; int main() { alsk::exec::ExecutorState> state; state.config(4); constexpr int n = 40; std::array, n> futures; std::puts("begin"); for(int i = 0; i < n; ++i) { futures[i] = state.run([i] { for(int x = 0; x < 20'000'000+5'000'000*i; ++x); }); } std::puts("wait"); std::promise p; std::future f = state.run([] { return 42; }, p); std::printf("with value: %d\n", f.get()); for(int i = 0; i < n; ++i) futures[i].wait(); std::puts("end"); }