From 415c3e63aeb5b83eaebfd89e7ba9228a81d8f395 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Tue, 8 Nov 2016 12:40:42 -0800 Subject: [PATCH] Add mutex lock in recordLine() for notification thread (#117) --- lib/src/sai_redis_record.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/src/sai_redis_record.cpp b/lib/src/sai_redis_record.cpp index 15c110c073cc..1946b51a2ad3 100644 --- a/lib/src/sai_redis_record.cpp +++ b/lib/src/sai_redis_record.cpp @@ -21,9 +21,12 @@ std::string getTimestamp() volatile bool g_record = true; std::ofstream recording; +std::mutex g_recordMutex; void recordLine(std::string s) { + std::lock_guard lock(g_recordMutex); + SWSS_LOG_ENTER(); if (recording.is_open())