Skip to content

Commit

Permalink
Add mutex lock in recordLine() for notification thread (sonic-net#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored and Shuotian Cheng committed Nov 8, 2016
1 parent fd88f12 commit 415c3e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/sai_redis_record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> lock(g_recordMutex);

SWSS_LOG_ENTER();

if (recording.is_open())
Expand Down

0 comments on commit 415c3e6

Please sign in to comment.