summaryrefslogtreecommitdiff
path: root/src/log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.cpp')
-rw-r--r--src/log.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/log.cpp b/src/log.cpp
index 366d83b64..527f54480 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
std::list<ILogOutput*> log_outputs[LMT_NUM_VALUES];
std::map<threadid_t, std::string> log_threadnames;
+JMutex log_threadnamemutex;
void log_add_output(ILogOutput *out, enum LogMessageLevel lev)
{
@@ -60,13 +61,17 @@ void log_remove_output(ILogOutput *out)
void log_register_thread(const std::string &name)
{
threadid_t id = get_current_thread_id();
+ log_threadnamemutex.Lock();
log_threadnames[id] = name;
+ log_threadnamemutex.Unlock();
}
void log_deregister_thread()
{
threadid_t id = get_current_thread_id();
+ log_threadnamemutex.Lock();
log_threadnames.erase(id);
+ log_threadnamemutex.Unlock();
}
static std::string get_lev_string(enum LogMessageLevel lev)
@@ -144,7 +149,7 @@ public:
}
m_buf += c;
}
-
+
private:
enum LogMessageLevel m_lev;
std::string m_buf;