| 98 | |
| 99 | public: |
| 100 | void _main() { |
| 101 | while (_continue) { |
| 102 | if (auto task = this->pop()) { |
| 103 | (*task)->run(); |
| 104 | } else { |
| 105 | std::unique_lock uniq_lock(_lock); |
| 106 | |
| 107 | if (ready()) { |
| 108 | continue; |
| 109 | } |
| 110 | |
| 111 | if (!_continue) { |
| 112 | break; |
| 113 | } |
| 114 | |
| 115 | if (auto tp = next()) { |
| 116 | _cv.wait_until(uniq_lock, *tp); |
| 117 | } else { |
| 118 | _cv.wait(uniq_lock); |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | // Execute remaining tasks |
| 124 | while (auto task = this->pop()) { |
| 125 | (*task)->run(); |
| 126 | } |
| 127 | } |
| 128 | }; |
| 129 | } // namespace thread_pool_util |
nothing calls this directly
no test coverage detected