]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/log.cpp
Fix formspec field labels
[dragonfireclient.git] / src / log.cpp
index 78fa32026f01f47149ac989e3dc3a79e3f469c83..527f544802966835b7d59968824e93b9e7f83b3f 100644 (file)
@@ -1,6 +1,6 @@
 /*
-Minetest-c55
-Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -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 @@ class Logbuf : public std::streambuf
                }
                m_buf += c;
        }
-       
+
 private:
        enum LogMessageLevel m_lev;
        std::string m_buf;