diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-18 01:59:10 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-18 01:59:10 +0000 |
commit | 16ff8604690ea63a3a82dd3b156061afb84dbcf1 (patch) | |
tree | a2d912258ecb0690f4a810ca1e438fc277160326 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | |
parent | a36a61d46ac3f2ea10e78ac816bca5784bc8ba35 (diff) | |
download | llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.zip llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.tar.gz llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.tar.bz2 |
remove use of Mutex in favour of std::{,recursive_}mutex
This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.
llvm-svn: 269877
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index 0274aa8..66e300a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -76,23 +76,22 @@ namespace //---------------------------------------------------------------------- // GDBRemoteCommunicationServerLLGS constructor //---------------------------------------------------------------------- -GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS( - const lldb::PlatformSP& platform_sp, - MainLoop &mainloop) : - GDBRemoteCommunicationServerCommon ("gdb-remote.server", "gdb-remote.server.rx_packet"), - m_platform_sp (platform_sp), - m_mainloop (mainloop), - m_current_tid (LLDB_INVALID_THREAD_ID), - m_continue_tid (LLDB_INVALID_THREAD_ID), - m_debugged_process_mutex (Mutex::eMutexTypeRecursive), - m_debugged_process_sp (), - m_stdio_communication ("process.stdio"), - m_inferior_prev_state (StateType::eStateInvalid), - m_active_auxv_buffer_sp (), - m_saved_registers_mutex (), - m_saved_registers_map (), - m_next_saved_registers_id (1), - m_handshake_completed (false) +GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS(const lldb::PlatformSP &platform_sp, + MainLoop &mainloop) + : GDBRemoteCommunicationServerCommon("gdb-remote.server", "gdb-remote.server.rx_packet"), + m_platform_sp(platform_sp), + m_mainloop(mainloop), + m_current_tid(LLDB_INVALID_THREAD_ID), + m_continue_tid(LLDB_INVALID_THREAD_ID), + m_debugged_process_mutex(), + m_debugged_process_sp(), + m_stdio_communication("process.stdio"), + m_inferior_prev_state(StateType::eStateInvalid), + m_active_auxv_buffer_sp(), + m_saved_registers_mutex(), + m_saved_registers_map(), + m_next_saved_registers_id(1), + m_handshake_completed(false) { assert(platform_sp); RegisterPacketHandlers(); @@ -210,7 +209,7 @@ GDBRemoteCommunicationServerLLGS::LaunchProcess () Error error; { - Mutex::Locker locker (m_debugged_process_mutex); + std::lock_guard<std::recursive_mutex> guard(m_debugged_process_mutex); assert (!m_debugged_process_sp && "lldb-gdbserver creating debugged process but one already exists"); error = NativeProcessProtocol::Launch( m_process_launch_info, @@ -2593,7 +2592,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState (StringExtractorGDBR // Save the register data buffer under the save id. { - Mutex::Locker locker (m_saved_registers_mutex); + std::lock_guard<std::mutex> guard(m_saved_registers_mutex); m_saved_registers_map[save_id] = register_data_sp; } @@ -2643,7 +2642,7 @@ GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState (StringExtractorG // Retrieve register state buffer, then remove from the list. DataBufferSP register_data_sp; { - Mutex::Locker locker (m_saved_registers_mutex); + std::lock_guard<std::mutex> guard(m_saved_registers_mutex); // Find the register set buffer for the given save id. auto it = m_saved_registers_map.find (save_id); @@ -2947,7 +2946,7 @@ GDBRemoteCommunicationServerLLGS::GetCurrentThreadID () const uint32_t GDBRemoteCommunicationServerLLGS::GetNextSavedRegistersID () { - Mutex::Locker locker (m_saved_registers_mutex); + std::lock_guard<std::mutex> guard(m_saved_registers_mutex); return m_next_saved_registers_id++; } |