| 45 | } |
| 46 | |
| 47 | size_t manual_executor::loop_impl(size_t max_count) { |
| 48 | if (max_count == 0) { |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | size_t executed = 0; |
| 53 | |
| 54 | while (true) { |
| 55 | if (executed == max_count) { |
| 56 | break; |
| 57 | } |
| 58 | |
| 59 | std::unique_lock<decltype(m_lock)> lock(m_lock); |
| 60 | if (m_abort) { |
| 61 | break; |
| 62 | } |
| 63 | |
| 64 | if (m_tasks.empty()) { |
| 65 | break; |
| 66 | } |
| 67 | |
| 68 | auto task = std::move(m_tasks.front()); |
| 69 | m_tasks.pop_front(); |
| 70 | lock.unlock(); |
| 71 | |
| 72 | task(); |
| 73 | ++executed; |
| 74 | } |
| 75 | |
| 76 | if (shutdown_requested()) { |
| 77 | details::throw_runtime_shutdown_exception(name); |
| 78 | } |
| 79 | |
| 80 | return executed; |
| 81 | } |
| 82 | |
| 83 | size_t manual_executor::loop_until_impl(size_t max_count, std::chrono::time_point<std::chrono::system_clock> deadline) { |
| 84 | if (max_count == 0) { |
nothing calls this directly
no test coverage detected