llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/137541.diff


1 Files Affected:

- (modified) lldb/tools/debugserver/source/DNBLog.cpp (+2-3) 


``````````diff
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);

``````````

</details>


https://github.com/llvm/llvm-project/pull/137541
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to