-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[debugserver] Migrate RNBRemote away from PThreadMutex (NFC) #137547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesThe 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. Full diff: https://github.com/llvm/llvm-project/pull/137547.diff 2 Files Affected:
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;
|
jasonmolenda
approved these changes
Apr 27, 2025
jyli0116
pushed a commit
to jyli0116/llvm-project
that referenced
this pull request
Apr 28, 2025
…7547) 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.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…7547) 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.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…7547) 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.
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
…7547) 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.
Ankur-0429
pushed a commit
to Ankur-0429/llvm-project
that referenced
this pull request
May 9, 2025
…7547) 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.