diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2017-02-05 15:52:21 +0200 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2017-02-05 15:52:21 +0200 |
commit | 935de2a8ec8fce9f6b51cf10f7d4d1ed29625420 (patch) | |
tree | 158cf4615f9a901826edf7860db461390688c8c2 /src/trex_watchdog.h | |
parent | 3b430b906317d4114e5ebe3e35bdd0ac430a463a (diff) |
WatchDog and IO functions: ensure we return it to normal timeout in case of exceptions in the middle of function.
Change-Id: I5d2e119f19c3e3214fdbe8108ea35af899ab49a5
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'src/trex_watchdog.h')
-rw-r--r-- | src/trex_watchdog.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/trex_watchdog.h b/src/trex_watchdog.h index 67dbb80d..b4512b6e 100644 --- a/src/trex_watchdog.h +++ b/src/trex_watchdog.h @@ -193,6 +193,8 @@ public: return instance; } + class IOFunction; + void init(bool enable); /** @@ -252,5 +254,30 @@ private: static bool g_signal_init; }; +class TrexWatchDog::IOFunction { +public: + static void io_begin() { + TrexMonitor * cur_monitor = TrexWatchDog::getInstance().get_current_monitor(); + if (cur_monitor != NULL) { + cur_monitor->io_begin(); + } + } + + static void io_end() { + TrexMonitor * cur_monitor = TrexWatchDog::getInstance().get_current_monitor(); + if (cur_monitor != NULL) { + cur_monitor->io_end(); + } + } + + IOFunction() { + IOFunction::io_begin(); + } + + ~IOFunction() { + IOFunction::io_end(); + } + +}; #endif /* __TREX_WATCHDOG_H__ */ |