return whether kill has been issued
| 554 | |
| 555 | //! return whether kill has been issued |
| 556 | bool watcher_impl(double timeout) { |
| 557 | using namespace std::chrono; |
| 558 | microseconds timeout_due{static_cast<uint64_t>(timeout * 1e6)}; |
| 559 | auto start = high_resolution_clock::now(), end = start + timeout_due; |
| 560 | for (;;) { |
| 561 | #if !__DEPLOY_ON_XP_SP2__ |
| 562 | std::unique_lock<std::mutex> lk(m_watcher_stop_mtx); |
| 563 | m_watcher_stop_cv.wait_until(lk, end); |
| 564 | #endif |
| 565 | |
| 566 | if (m_watcher_should_stop) |
| 567 | return false; |
| 568 | |
| 569 | if (high_resolution_clock::now() >= end) { |
| 570 | kill_worker(); |
| 571 | return true; |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | void kill_worker() override { |
| 577 | if (m_worker_pid) { |
nothing calls this directly
no test coverage detected