add indefinite `sleep()` function to `SleeperThread`
This commit is contained in:
parent
4d32991bee
commit
7c28ffc856
|
@ -58,6 +58,12 @@ class SleeperThread {
|
||||||
|
|
||||||
bool isRunning() const { return do_run_; }
|
bool isRunning() const { return do_run_; }
|
||||||
|
|
||||||
|
auto sleep() {
|
||||||
|
std::unique_lock lk(mutex_);
|
||||||
|
CancellationGuard cancel_lock;
|
||||||
|
return condvar_.wait(lk);
|
||||||
|
}
|
||||||
|
|
||||||
auto sleep_for(std::chrono::system_clock::duration dur) {
|
auto sleep_for(std::chrono::system_clock::duration dur) {
|
||||||
std::unique_lock lk(mutex_);
|
std::unique_lock lk(mutex_);
|
||||||
CancellationGuard cancel_lock;
|
CancellationGuard cancel_lock;
|
||||||
|
|
Loading…
Reference in New Issue