Thread function */
| 97 | } |
| 98 | /** Thread function */ |
| 99 | void Run() |
| 100 | { |
| 101 | while (true) { |
| 102 | std::unique_ptr<WorkItem> i; |
| 103 | { |
| 104 | WAIT_LOCK(cs, lock); |
| 105 | while (running && queue.empty()) |
| 106 | cond.wait(lock); |
| 107 | if (!running && queue.empty()) |
| 108 | break; |
| 109 | i = std::move(queue.front()); |
| 110 | queue.pop_front(); |
| 111 | } |
| 112 | (*i)(); |
| 113 | } |
| 114 | } |
| 115 | /** Interrupt and exit loops */ |
| 116 | void Interrupt() |
| 117 | { |
no test coverage detected