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/Target/Thread.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/Target/Thread.cpp')
-rw-r--r-- | lldb/source/Target/Thread.cpp | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 3062623..a2905016 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -9,7 +9,6 @@ // C Includes // C++ Includes -#include <mutex> // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointLocation.h" @@ -271,36 +270,36 @@ Thread::GetStaticBroadcasterClass () return class_name; } -Thread::Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id) : - ThreadProperties (false), - UserID (tid), - Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(), Thread::GetStaticBroadcasterClass().AsCString()), - m_process_wp (process.shared_from_this()), - m_stop_info_sp (), - m_stop_info_stop_id (0), - m_stop_info_override_stop_id (0), - m_index_id (use_invalid_index_id ? LLDB_INVALID_INDEX32 : process.GetNextThreadIndexID(tid)), - m_reg_context_sp (), - m_state (eStateUnloaded), - m_state_mutex (Mutex::eMutexTypeRecursive), - m_plan_stack (), - m_completed_plan_stack(), - m_frame_mutex (Mutex::eMutexTypeRecursive), - m_curr_frames_sp (), - m_prev_frames_sp (), - m_resume_signal (LLDB_INVALID_SIGNAL_NUMBER), - m_resume_state (eStateRunning), - m_temporary_resume_state (eStateRunning), - m_unwinder_ap (), - m_destroy_called (false), - m_override_should_notify (eLazyBoolCalculate), - m_extended_info_fetched (false), - m_extended_info () -{ - Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); +Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id) + : ThreadProperties(false), + UserID(tid), + Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(), + Thread::GetStaticBroadcasterClass().AsCString()), + m_process_wp(process.shared_from_this()), + m_stop_info_sp(), + m_stop_info_stop_id(0), + m_stop_info_override_stop_id(0), + m_index_id(use_invalid_index_id ? LLDB_INVALID_INDEX32 : process.GetNextThreadIndexID(tid)), + m_reg_context_sp(), + m_state(eStateUnloaded), + m_state_mutex(), + m_plan_stack(), + m_completed_plan_stack(), + m_frame_mutex(), + m_curr_frames_sp(), + m_prev_frames_sp(), + m_resume_signal(LLDB_INVALID_SIGNAL_NUMBER), + m_resume_state(eStateRunning), + m_temporary_resume_state(eStateRunning), + m_unwinder_ap(), + m_destroy_called(false), + m_override_should_notify(eLazyBoolCalculate), + m_extended_info_fetched(false), + m_extended_info() +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); if (log) - log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", - static_cast<void*>(this), GetID()); + log->Printf("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", static_cast<void *>(this), GetID()); CheckInWithManager(); QueueFundamentalPlan(true); @@ -345,7 +344,7 @@ Thread::DestroyThread () m_stop_info_sp.reset(); m_reg_context_sp.reset(); m_unwinder_ap.reset(); - Mutex::Locker locker(m_frame_mutex); + std::lock_guard<std::recursive_mutex> guard(m_frame_mutex); m_curr_frames_sp.reset(); m_prev_frames_sp.reset(); } @@ -645,14 +644,14 @@ StateType Thread::GetState() const { // If any other threads access this we will need a mutex for it - Mutex::Locker locker(m_state_mutex); + std::lock_guard<std::recursive_mutex> guard(m_state_mutex); return m_state; } void Thread::SetState(StateType state) { - Mutex::Locker locker(m_state_mutex); + std::lock_guard<std::recursive_mutex> guard(m_state_mutex); m_state = state; } @@ -1823,7 +1822,7 @@ StackFrameListSP Thread::GetStackFrameList () { StackFrameListSP frame_list_sp; - Mutex::Locker locker(m_frame_mutex); + std::lock_guard<std::recursive_mutex> guard(m_frame_mutex); if (m_curr_frames_sp) { frame_list_sp = m_curr_frames_sp; @@ -1839,7 +1838,7 @@ Thread::GetStackFrameList () void Thread::ClearStackFrames () { - Mutex::Locker locker(m_frame_mutex); + std::lock_guard<std::recursive_mutex> guard(m_frame_mutex); Unwind *unwinder = GetUnwinder (); if (unwinder) |