Skip to content

Commit

Permalink
Add a mutex
Browse files Browse the repository at this point in the history
Signed-off-by: Darby Johnston <darbyjohnston@yahoo.com>
  • Loading branch information
darbyjohnston committed Dec 10, 2024
1 parent 69bdddd commit 9daa04a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/toucan/MessageLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace toucan
const std::string& message,
MessageLogType type)
{
std::unique_lock<std::mutex> lock(_mutex);
switch (type)
{
case MessageLogType::Info:
Expand Down
4 changes: 4 additions & 0 deletions lib/toucan/MessageLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <memory>
#include <mutex>
#include <string>

namespace toucan
Expand All @@ -24,5 +25,8 @@ namespace toucan
const std::string& prefix,
const std::string& message,
MessageLogType = MessageLogType::Info);

private:
std::mutex _mutex;
};
}

0 comments on commit 9daa04a

Please sign in to comment.