| 252 | } |
| 253 | |
| 254 | void resume() { |
| 255 | std::lock_guard<std::mutex> lock(mtx); |
| 256 | |
| 257 | if (running) { |
| 258 | return; |
| 259 | } |
| 260 | |
| 261 | running = true; |
| 262 | |
| 263 | thrd = std::thread([this]() { |
| 264 | while (true) { |
| 265 | { |
| 266 | std::unique_lock<std::mutex> lock(mtx); |
| 267 | cv.wait(lock, [this]() { return head != tail; }); |
| 268 | |
| 269 | cur = entries[head]; |
| 270 | |
| 271 | head = (head + 1) % entries.size(); |
| 272 | } |
| 273 | |
| 274 | if (cur.is_end) { |
| 275 | break; |
| 276 | } |
| 277 | |
| 278 | cur.print(); // stdout and stderr |
| 279 | |
| 280 | if (file) { |
| 281 | cur.print(file); |
| 282 | } |
| 283 | } |
| 284 | }); |
| 285 | } |
| 286 | |
| 287 | void pause() { |
| 288 | { |
no test coverage detected