Thread function */
| 116 | } |
| 117 | /** Thread function */ |
| 118 | void Run() { |
| 119 | while (true) { |
| 120 | std::unique_ptr<WorkItem> i; |
| 121 | { |
| 122 | STD_WAIT_LOCK(cs, lock); |
| 123 | while (running && queue.empty()) cond.wait(lock); |
| 124 | if (!running) break; |
| 125 | i = std::move(queue.front()); |
| 126 | queue.pop_front(); |
| 127 | } |
| 128 | (*i)(); |
| 129 | } |
| 130 | } |
| 131 | /** Interrupt and exit loops */ |
| 132 | void Interrupt() { |
| 133 | STD_LOCK(cs); |
no test coverage detected