summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/trex_watchdog.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/trex_watchdog.cpp b/src/trex_watchdog.cpp
index c72ce69e..d099933b 100644
--- a/src/trex_watchdog.cpp
+++ b/src/trex_watchdog.cpp
@@ -225,8 +225,10 @@ void TrexWatchDog::_main() {
dsec_t now = now_sec();
- /* volatile are slow - read once per iteration */
+ /* to be on the safe side - read the count with a lock */
+ std::unique_lock<std::mutex> lock(m_lock);
int count = m_mon_count;
+ lock.unlock();
for (int i = 0; i < count; i++) {
TrexMonitor *monitor = m_monitors[i];