From 9ab4b3b49b18c287fb36bc20e4e0c6994c8110c6 Mon Sep 17 00:00:00 2001 From: MichaelAxtmann Date: Mon, 29 Jul 2019 13:09:37 +0200 Subject: [PATCH] Add unwatch function --- TimeoutGuard.cpp | 6 ++++++ TimeoutGuard.h | 1 + 2 files changed, 7 insertions(+) diff --git a/TimeoutGuard.cpp b/TimeoutGuard.cpp index a5a2be0..b987885 100644 --- a/TimeoutGuard.cpp +++ b/TimeoutGuard.cpp @@ -68,6 +68,12 @@ namespace utility wakeup.notify_all(); } + void TimeoutGuard::unwatch() { + touch(); + idle.store( true ); + wakeup.notify_all(); + } + void TimeoutGuard::touch() { touched.store( clock::now() ); diff --git a/TimeoutGuard.h b/TimeoutGuard.h index 3e2e6ce..fbc8eb4 100644 --- a/TimeoutGuard.h +++ b/TimeoutGuard.h @@ -46,6 +46,7 @@ namespace utility TimeoutGuard & operator=( TimeoutGuard && ) = delete; void watch(); + void unwatch(); void touch(); private: