summaryrefslogtreecommitdiffstats
path: root/src/trex_watchdog.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-12-21 14:25:16 +0200
committerimarom <imarom@cisco.com>2016-12-21 14:49:09 +0200
commitfff19c8c2faced0972601ca9956bb36a33aa6e87 (patch)
tree36a120e226f78ad974a7086bbd396d8d26131b41 /src/trex_watchdog.cpp
parentbf7c614dc174697b416eb3dfad515cedb104028b (diff)
watchdog disable for time capability
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'src/trex_watchdog.cpp')
-rw-r--r--src/trex_watchdog.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/trex_watchdog.cpp b/src/trex_watchdog.cpp
index 9b6f5865..d2bbeafa 100644
--- a/src/trex_watchdog.cpp
+++ b/src/trex_watchdog.cpp
@@ -126,12 +126,15 @@ static void _callstack_signal_handler(int signr, siginfo_t *info, void *secret)
*************************************/
void TrexMonitor::create(const std::string &name, double timeout_sec) {
- m_active = true;
- m_tid = pthread_self();
- m_name = name;
- m_timeout_sec = timeout_sec;
- m_tickled = true;
- m_ts = 0;
+ m_active_time_sec = now_sec();
+ m_tid = pthread_self();
+ m_name = name;
+ m_timeout_sec = timeout_sec;
+ m_tickled = true;
+ m_ts = 0;
+
+ /* the rare case of m_active_time_sec set out of order with tickled */
+ asm volatile("mfence" ::: "memory");
}
/**************************************
@@ -236,7 +239,7 @@ void TrexWatchDog::_main() {
TrexMonitor *monitor = m_monitors[i];
/* skip non active monitors */
- if (!monitor->is_active()) {
+ if (!monitor->is_active(now)) {
continue;
}