[Lldb-commits] [lldb] e886ba1 - [debugserver] Migrate RNBRemote away from PThreadMutex (NFC) (#137547)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Apr 27 15:16:45 PDT 2025
Author: Jonas Devlieghere
Date: 2025-04-27T15:16:42-07:00
New Revision: e886ba1d5971ddb3b9242f7300cc97646670e9ce
URL: https://github.com/llvm/llvm-project/commit/e886ba1d5971ddb3b9242f7300cc97646670e9ce
DIFF: https://github.com/llvm/llvm-project/commit/e886ba1d5971ddb3b9242f7300cc97646670e9ce.diff
LOG: [debugserver] Migrate RNBRemote away from PThreadMutex (NFC) (#137547)
The debugserver code predates modern C++, but with C++11 and later
there's no need to have something like PThreadMutex. This migrates
RNBRemote away from PThreadMutex in preparation for removing it.
Added:
Modified:
lldb/tools/debugserver/source/RNBRemote.cpp
lldb/tools/debugserver/source/RNBRemote.h
Removed:
################################################################################
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index eb7c5ca32c02a..e0831023e7ae4 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -820,7 +820,7 @@ rnb_err_t RNBRemote::GetPacketPayload(std::string &return_packet) {
// (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), __FUNCTION__);
{
- PThreadMutex::Locker locker(m_mutex);
+ std::lock_guard<std::mutex> guard(m_mutex);
if (m_rx_packets.empty()) {
// Only reset the remote command available event if we have no more
// packets
@@ -1052,7 +1052,7 @@ void RNBRemote::CommDataReceived(const std::string &new_data) {
// (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), __FUNCTION__);
// Put the packet data into the buffer in a thread safe fashion
- PThreadMutex::Locker locker(m_mutex);
+ std::lock_guard<std::mutex> guard(m_mutex);
std::string data;
// See if we have any left over data from a previous call to this
diff --git a/lldb/tools/debugserver/source/RNBRemote.h b/lldb/tools/debugserver/source/RNBRemote.h
index c552713551013..ad254ae90e2f7 100644
--- a/lldb/tools/debugserver/source/RNBRemote.h
+++ b/lldb/tools/debugserver/source/RNBRemote.h
@@ -14,7 +14,6 @@
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBREMOTE_H
#include "DNB.h"
-#include "PThreadMutex.h"
#include "RNBContext.h"
#include "RNBDefs.h"
#include "RNBSocket.h"
@@ -25,7 +24,6 @@
class RNBSocket;
class RNBContext;
-class PThreadEvents;
enum event_loop_mode { debug_nub, gdb_remote_protocol, done };
@@ -379,7 +377,7 @@ class RNBRemote {
std::string m_arch;
nub_thread_t m_continue_thread; // thread to continue; 0 for any, -1 for all
nub_thread_t m_thread; // thread for other ops; 0 for any, -1 for all
- PThreadMutex m_mutex; // Mutex that protects
+ std::mutex m_mutex; // Mutex that protects
DispatchQueueOffsets m_dispatch_queue_offsets;
nub_addr_t m_dispatch_queue_offsets_addr;
uint32_t m_qSymbol_index;
More information about the lldb-commits
mailing list