From 8c5a2298627c6cbe37782f3b33e8d6c43ed9c4d8 Mon Sep 17 00:00:00 2001 From: Vishwanatha Subbanna Date: Tue, 30 May 2017 15:34:23 +0530 Subject: Invoke optional callback function on timer expiration When the timer expires, it calls into it's own timeout handler which matches with sd_event callback handler. However, it is beneficial if the users of timer register their own callback routine so that they can execute some operations on timeout. Change-Id: Ia88cb4e3c17f6dd8d4528fa193ec7927f083a92b Signed-off-by: Vishwanatha Subbanna --- watchdog.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'watchdog.cpp') diff --git a/watchdog.cpp b/watchdog.cpp index c9e9919..e5e8aff 100644 --- a/watchdog.cpp +++ b/watchdog.cpp @@ -1,7 +1,6 @@ #include #include #include "watchdog.hpp" - namespace phosphor { namespace watchdog @@ -92,5 +91,13 @@ uint64_t Watchdog::timeRemaining(uint64_t value) return 0; } +// Optional callback function on timer expiration +void Watchdog::timeOutHandler() +{ + log("Optional callback called"); + // TODO: Need to call the user passed systemd + // target on this condition +} + } // namespace watchdog } // namepsace phosphor -- cgit v1.2.1