Skip to content

Commit e886ba1

Browse files
authored
[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.
1 parent c3858e5 commit e886ba1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lldb/tools/debugserver/source/RNBRemote.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ rnb_err_t RNBRemote::GetPacketPayload(std::string &return_packet) {
820820
// (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), __FUNCTION__);
821821

822822
{
823-
PThreadMutex::Locker locker(m_mutex);
823+
std::lock_guard<std::mutex> guard(m_mutex);
824824
if (m_rx_packets.empty()) {
825825
// Only reset the remote command available event if we have no more
826826
// packets
@@ -1052,7 +1052,7 @@ void RNBRemote::CommDataReceived(const std::string &new_data) {
10521052
// (uint32_t)m_comm.Timer().ElapsedMicroSeconds(true), __FUNCTION__);
10531053

10541054
// Put the packet data into the buffer in a thread safe fashion
1055-
PThreadMutex::Locker locker(m_mutex);
1055+
std::lock_guard<std::mutex> guard(m_mutex);
10561056

10571057
std::string data;
10581058
// See if we have any left over data from a previous call to this

lldb/tools/debugserver/source/RNBRemote.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define LLDB_TOOLS_DEBUGSERVER_SOURCE_RNBREMOTE_H
1515

1616
#include "DNB.h"
17-
#include "PThreadMutex.h"
1817
#include "RNBContext.h"
1918
#include "RNBDefs.h"
2019
#include "RNBSocket.h"
@@ -25,7 +24,6 @@
2524

2625
class RNBSocket;
2726
class RNBContext;
28-
class PThreadEvents;
2927

3028
enum event_loop_mode { debug_nub, gdb_remote_protocol, done };
3129

@@ -379,7 +377,7 @@ class RNBRemote {
379377
std::string m_arch;
380378
nub_thread_t m_continue_thread; // thread to continue; 0 for any, -1 for all
381379
nub_thread_t m_thread; // thread for other ops; 0 for any, -1 for all
382-
PThreadMutex m_mutex; // Mutex that protects
380+
std::mutex m_mutex; // Mutex that protects
383381
DispatchQueueOffsets m_dispatch_queue_offsets;
384382
nub_addr_t m_dispatch_queue_offsets_addr;
385383
uint32_t m_qSymbol_index;

0 commit comments

Comments
 (0)