| 88 | void setThreadTask(std::function<void()> task) { task_ = std::move(task); } |
| 89 | |
| 90 | bool waitForEnd(int ms_timeout) { |
| 91 | long long ms_start = time::milliseconds(); |
| 92 | while (!completed()) { |
| 93 | if (time::milliseconds() - ms_start > ms_timeout) |
| 94 | return false; |
| 95 | |
| 96 | sleep(5); |
| 97 | } |
| 98 | stop(); |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | const std::string& name() const { return name_; } |
| 103 | bool shouldRun() const { return should_run_.load(); } |
no test coverage detected