X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fdebug.cpp;h=8647160b1bed7c20cae3dae6e035bfc23bef521e;hb=5a2431a9bd9a019a47cd279ac988435b075cdabe;hp=ae2ffadc3e2e5de24f5ff1f946ec80834529345d;hpb=3d53c90d4b34563ef27bc38da211dab91b72d321;p=minetest.git diff --git a/src/debug.cpp b/src/debug.cpp index ae2ffadc3..8647160b1 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -26,8 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include "jthread/jmutex.h" -#include "jthread/jmutexautolock.h" +#include +#include "threading/mutex.h" +#include "threading/mutex_auto_lock.h" #include "config.h" #ifdef _MSC_VER @@ -36,98 +37,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #endif -/* - Debug output -*/ - -#define DEBUGSTREAM_COUNT 2 - -FILE *g_debugstreams[DEBUGSTREAM_COUNT] = {stderr, NULL}; - -#define DEBUGPRINT(...)\ -{\ - for(int i=0; i g_debug_stacks; -JMutex g_debug_stacks_mutex; +Mutex g_debug_stacks_mutex; void debug_stacks_init() { @@ -237,7 +160,7 @@ void debug_stacks_init() void debug_stacks_print_to(std::ostream &os) { - JMutexAutoLock lock(g_debug_stacks_mutex); + MutexAutoLock lock(g_debug_stacks_mutex); os<<"Debug stacks:"<::iterator - i = g_debug_stacks.begin(); - i != g_debug_stacks.end(); ++i) - { - DebugStack *stack = i->second; - - for(int i=0; iprint(g_debugstreams[i], true); - } - } + debug_stacks_print_to(errorstream); } DebugStacker::DebugStacker(const char *text) { - threadid_t threadid = get_current_thread_id(); + threadid_t threadid = thr_get_current_thread_id(); - JMutexAutoLock lock(g_debug_stacks_mutex); + MutexAutoLock lock(g_debug_stacks_mutex); std::map::iterator n; n = g_debug_stacks.find(threadid); @@ -307,7 +215,7 @@ DebugStacker::DebugStacker(const char *text) DebugStacker::~DebugStacker() { - JMutexAutoLock lock(g_debug_stacks_mutex); + MutexAutoLock lock(g_debug_stacks_mutex); if(m_overflowed == true) return;