Author: Jonas Devlieghere
Date: 2025-04-27T13:08:04-07:00
New Revision: 0755e024fcfc9313d866ed5432133f8755901c95

URL: 
https://github.com/llvm/llvm-project/commit/0755e024fcfc9313d866ed5432133f8755901c95
DIFF: 
https://github.com/llvm/llvm-project/commit/0755e024fcfc9313d866ed5432133f8755901c95.diff

LOG: [debugserver] Migrate DNBLog away from PThreadMutex (NFC) (#137541)

The debugserver code predates modern C++, but with C++11 and later
there's no need to have something like PThreadMutex. This migrates
DNBLog away from that class in preparation for removing PThreadMutex.

Added: 
    

Modified: 
    lldb/tools/debugserver/source/DNBLog.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/debugserver/source/DNBLog.cpp 
b/lldb/tools/debugserver/source/DNBLog.cpp
index d3045ace16f3d..6ad6b6598d1c3 100644
--- a/lldb/tools/debugserver/source/DNBLog.cpp
+++ b/lldb/tools/debugserver/source/DNBLog.cpp
@@ -17,7 +17,6 @@ static int g_verbose = 0;
 
 #if defined(DNBLOG_ENABLED)
 
-#include "PThreadMutex.h"
 #include <cstdarg>
 #include <cstdio>
 #include <cstdlib>
@@ -64,8 +63,8 @@ bool DNBLogEnabledForAny(uint32_t mask) {
 }
 static inline void _DNBLogVAPrintf(uint32_t flags, const char *format,
                                    va_list args) {
-  static PThreadMutex g_LogThreadedMutex(PTHREAD_MUTEX_RECURSIVE);
-  PTHREAD_MUTEX_LOCKER(locker, g_LogThreadedMutex);
+  static std::recursive_mutex g_LogThreadedMutex;
+  std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
 
   if (g_log_callback)
     g_log_callback(g_log_baton, flags, format, args);


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to