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