MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / main

Function main

example/7_when_all/source/main.cpp:33–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int main(int argc, const char* argv[]) {
34 concurrencpp::runtime runtime;
35 auto background_executor = runtime.background_executor();
36 auto thread_pool_executor = runtime.thread_pool_executor();
37 std::vector<concurrencpp::result<int>> results;
38
39 std::srand(static_cast<unsigned>(std::time(nullptr)));
40
41 for (int i = 0; i < 10; i++) {
42 const auto sleeping_time_ms = std::rand() % 1000;
43 results.emplace_back(background_executor->submit(example_job, i, i * 15, sleeping_time_ms));
44 }
45
46 consume_all_tasks(thread_pool_executor, std::move(results)).get();
47 return 0;
48}

Callers

nothing calls this directly

Calls 4

consume_all_tasksFunction · 0.85
background_executorMethod · 0.80
thread_pool_executorMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected