| 38 | } |
| 39 | |
| 40 | int 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 | } |
nothing calls this directly
no test coverage detected