diff options
author | Pavel Labath <labath@google.com> | 2016-08-25 08:34:57 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2016-08-25 08:34:57 +0000 |
commit | 0faf37333c8bf7eaca3500c7d79c7fb99112caa5 (patch) | |
tree | 4ed0654fdfd3d54bf74b110cfc86e910192ad71a /lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h | |
parent | c1566308aa7596efad6d3ddc852eb3b443748309 (diff) | |
download | llvm-0faf37333c8bf7eaca3500c7d79c7fb99112caa5.zip llvm-0faf37333c8bf7eaca3500c7d79c7fb99112caa5.tar.gz llvm-0faf37333c8bf7eaca3500c7d79c7fb99112caa5.tar.bz2 |
gdb-remote: Make the sequence mutex non-recursive
Summary:
This is a preparatory commit for D22914, where I'd like to replace this mutex by an R/W lock
(which is also not recursive). This required a couple of changes:
- The only caller of Read/WriteRegister, GDBRemoteRegisterContext class, was already acquiring
the mutex, so these functions do not need to. All functions which now do not take a lock, take
an lock argument instead, to remind the caller of this fact.
- GetThreadSuffixSupported() was being called from locked and unlocked contexts (including
contexts where the process was running, and the call would fail if it did not have the result
cached). I have split this into two functions, one which computes the thread suffix support and
caches it (this one always takes the lock), and another, which returns the cached value (and
never needs to take the lock). This feels quite natural as ProcessGdbRemote was already
pre-caching this value at the start.
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D23802
llvm-svn: 279725
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h index 684ef3e..a3bcc86 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h @@ -73,7 +73,7 @@ public: Lock(GDBRemoteClientBase &comm, bool interrupt); ~Lock(); - explicit operator bool() { return m_acquired; } + explicit operator bool() const { return m_acquired; } // Whether we had to interrupt the continue thread to acquire the connection. bool @@ -83,7 +83,7 @@ public: } private: - std::unique_lock<std::recursive_mutex> m_async_lock; + std::unique_lock<std::mutex> m_async_lock; GDBRemoteClientBase &m_comm; bool m_acquired; bool m_did_interrupt; @@ -94,7 +94,7 @@ public: protected: PacketResult - SendPacketAndWaitForResponseNoLock(llvm::StringRef payload, StringExtractorGDBRemote &response); + SendPacketAndWaitForResponse(llvm::StringRef payload, StringExtractorGDBRemote &response, const Lock &lock); virtual void OnRunPacketSent(bool first); @@ -126,7 +126,7 @@ private: // This handles the synchronization between individual async threads. For now they just use a // simple mutex. - std::recursive_mutex m_async_mutex; + std::mutex m_async_mutex; bool ShouldStop(const UnixSignals &signals, StringExtractorGDBRemote &response); |