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

Function main

example/8_when_any/source/main.cpp:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int main(int argc, const char* argv[]) {
41 concurrencpp::runtime runtime;
42 auto background_executor = runtime.background_executor();
43 auto thread_pool_executor = runtime.thread_pool_executor();
44 std::vector<concurrencpp::result<int>> results;
45
46 std::srand(static_cast<unsigned>(std::time(nullptr)));
47
48 for (int i = 0; i < 10; i++) {
49 const auto sleeping_time_ms = std::rand() % 1000;
50 results.emplace_back(background_executor->submit(example_job, i, i * 15, sleeping_time_ms));
51 }
52
53 consume_tasks_as_they_finish(thread_pool_executor, std::move(results)).get();
54 return 0;
55}

Callers

nothing calls this directly

Calls 4

background_executorMethod · 0.80
thread_pool_executorMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected