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