diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-19 05:13:57 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-19 05:13:57 +0000 |
commit | bb19a13c0b3fe1ecdc1e46bbf2b06ffc1e25e04e (patch) | |
tree | a4383c7cf16b2a6b8e8aa1ff61435ceec0c6a7de /lldb/source/API/SBTarget.cpp | |
parent | fe12d0e3e551a29b880ecfc7673810ce18567765 (diff) | |
download | bcm5719-llvm-bb19a13c0b3fe1ecdc1e46bbf2b06ffc1e25e04e.tar.gz bcm5719-llvm-bb19a13c0b3fe1ecdc1e46bbf2b06ffc1e25e04e.zip |
second pass over removal of Mutex and Condition
llvm-svn: 270024
Diffstat (limited to 'lldb/source/API/SBTarget.cpp')
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index df3001b6c72..6a5301b0605 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -77,7 +77,7 @@ namespace { Error AttachToProcess (ProcessAttachInfo &attach_info, Target &target) { - Mutex::Locker api_locker (target.GetAPIMutex ()); + std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex()); auto process_sp = target.GetProcessSP (); if (process_sp) @@ -267,7 +267,7 @@ SBTarget::Install() TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); sb_error.ref() = target_sp->Install(NULL); } return sb_error; @@ -307,7 +307,7 @@ SBTarget::Launch if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); if (stop_at_entry) launch_flags |= eLaunchFlagStopAtEntry; @@ -394,7 +394,7 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error) if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); StateType state = eStateInvalid; { ProcessSP process_sp = target_sp->GetProcessSP(); @@ -622,7 +622,7 @@ SBTarget::ConnectRemote if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); if (listener.IsValid()) process_sp = target_sp->CreateProcess (listener.m_opaque_sp, plugin_name, NULL); else @@ -706,7 +706,7 @@ SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr) TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); if (target_sp->ResolveLoadAddress (vm_addr, addr)) return sb_addr; } @@ -725,7 +725,7 @@ SBTarget::ResolveFileAddress (lldb::addr_t file_addr) TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); if (target_sp->ResolveFileAddress (file_addr, addr)) return sb_addr; } @@ -742,7 +742,7 @@ SBTarget::ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr) TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); if (target_sp->ResolveLoadAddress (vm_addr, addr)) return sb_addr; } @@ -778,7 +778,7 @@ SBTarget::ReadMemory (const SBAddress addr, TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); bytes_read = target_sp->ReadMemory(addr.ref(), false, buf, size, sb_error.ref()); } else @@ -814,7 +814,7 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, TargetSP target_sp(GetSP()); if (target_sp && line != 0) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const LazyBool check_inlines = eLazyBoolCalculate; const LazyBool skip_prologue = eLazyBoolCalculate; @@ -856,7 +856,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, TargetSP target_sp(GetSP()); if (target_sp.get()) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const bool internal = false; const bool hardware = false; @@ -916,7 +916,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const bool internal = false; const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); *sb_bp = target_sp->CreateBreakpoint (module_list.get(), comp_unit_list.get(), symbol_name, @@ -972,7 +972,7 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[], TargetSP target_sp(GetSP()); if (target_sp && num_names > 0) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const bool internal = false; const bool hardware = false; const LazyBool skip_prologue = eLazyBoolCalculate; @@ -1045,7 +1045,7 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, TargetSP target_sp(GetSP()); if (target_sp && symbol_name_regex && symbol_name_regex[0]) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); RegularExpression regexp(symbol_name_regex); const bool internal = false; const bool hardware = false; @@ -1071,7 +1071,7 @@ SBTarget::BreakpointCreateByAddress (addr_t address) TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const bool hardware = false; *sb_bp = target_sp->CreateBreakpoint (address, false, hardware); } @@ -1102,7 +1102,7 @@ SBTarget::BreakpointCreateBySBAddress (SBAddress &sb_address) if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const bool hardware = false; *sb_bp = target_sp->CreateBreakpoint (sb_address.ref(), false, hardware); } @@ -1162,7 +1162,7 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, TargetSP target_sp(GetSP()); if (target_sp && source_regex && source_regex[0]) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const bool hardware = false; const LazyBool move_to_nearest_code = eLazyBoolCalculate; RegularExpression regexp(source_regex); @@ -1200,7 +1200,7 @@ SBTarget::BreakpointCreateForException (lldb::LanguageType language, TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); const bool hardware = false; *sb_bp = target_sp->CreateExceptionBreakpoint (language, catch_bp, throw_bp, hardware); } @@ -1249,7 +1249,7 @@ SBTarget::BreakpointDelete (break_id_t bp_id) TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); result = target_sp->RemoveBreakpointByID (bp_id); } @@ -1270,7 +1270,7 @@ SBTarget::FindBreakpointByID (break_id_t bp_id) TargetSP target_sp(GetSP()); if (target_sp && bp_id != LLDB_INVALID_BREAK_ID) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); *sb_breakpoint = target_sp->GetBreakpointByID (bp_id); } @@ -1289,7 +1289,7 @@ SBTarget::EnableAllBreakpoints () TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); target_sp->EnableAllBreakpoints (); return true; } @@ -1302,7 +1302,7 @@ SBTarget::DisableAllBreakpoints () TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); target_sp->DisableAllBreakpoints (); return true; } @@ -1315,7 +1315,7 @@ SBTarget::DeleteAllBreakpoints () TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); target_sp->RemoveAllBreakpoints (); return true; } @@ -1356,9 +1356,9 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id) TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - Mutex::Locker locker; - target_sp->GetWatchpointList().GetListMutex(locker); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); + std::unique_lock<std::recursive_mutex> lock; + target_sp->GetWatchpointList().GetListMutex(lock); result = target_sp->RemoveWatchpointByID (wp_id); } @@ -1380,9 +1380,9 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id) TargetSP target_sp(GetSP()); if (target_sp && wp_id != LLDB_INVALID_WATCH_ID) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - Mutex::Locker locker; - target_sp->GetWatchpointList().GetListMutex(locker); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); + std::unique_lock<std::recursive_mutex> lock; + target_sp->GetWatchpointList().GetListMutex(lock); watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id); sb_watchpoint.SetSP (watchpoint_sp); } @@ -1406,7 +1406,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S TargetSP target_sp(GetSP()); if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS && size > 0) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); uint32_t watch_type = 0; if (read) watch_type |= LLDB_WATCH_TYPE_READ; @@ -1442,9 +1442,9 @@ SBTarget::EnableAllWatchpoints () TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - Mutex::Locker locker; - target_sp->GetWatchpointList().GetListMutex(locker); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); + std::unique_lock<std::recursive_mutex> lock; + target_sp->GetWatchpointList().GetListMutex(lock); target_sp->EnableAllWatchpoints (); return true; } @@ -1457,9 +1457,9 @@ SBTarget::DisableAllWatchpoints () TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - Mutex::Locker locker; - target_sp->GetWatchpointList().GetListMutex(locker); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); + std::unique_lock<std::recursive_mutex> lock; + target_sp->GetWatchpointList().GetListMutex(lock); target_sp->DisableAllWatchpoints (); return true; } @@ -1551,9 +1551,9 @@ SBTarget::DeleteAllWatchpoints () TargetSP target_sp(GetSP()); if (target_sp) { - Mutex::Locker api_locker (target_sp->GetAPIMutex()); - Mutex::Locker locker; - target_sp->GetWatchpointList().GetListMutex(locker); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); + std::unique_lock<std::recursive_mutex> lock; + target_sp->GetWatchpointList().GetListMutex(lock); target_sp->RemoveAllWatchpoints (); return true; } @@ -2431,7 +2431,7 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio return expr_result; } - Mutex::Locker api_locker (target_sp->GetAPIMutex()); + std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); ExecutionContext exe_ctx (m_opaque_sp.get()); if (log) |