second pass over removal of Mutex and Condition

llvm-svn: 270024
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index f95fcb8..470ea56 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -15,7 +15,6 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/StreamString.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/LineEntry.h"
 #include "lldb/Target/Target.h"
 
@@ -125,7 +124,7 @@
     {
         if (m_opaque_ap->IsValid())
         {
-            Mutex::Locker api_locker (target_sp->GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
             addr = m_opaque_ap->GetLoadAddress (target_sp.get());
         }
     }
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index 1f58ddb..ec3a3de 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -149,7 +149,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->ClearAllBreakpointSites ();
     }
 }
@@ -163,7 +163,7 @@
     {
         if (vm_addr != LLDB_INVALID_ADDRESS)
         {
-            Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
             Address address;
             Target &target = m_opaque_sp->GetTarget();
             if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address))
@@ -183,7 +183,7 @@
 
     if (m_opaque_sp && vm_addr != LLDB_INVALID_ADDRESS)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         Address address;
         Target &target = m_opaque_sp->GetTarget();
         if (!target.GetSectionLoadList().ResolveLoadAddress(vm_addr, address))
@@ -203,7 +203,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id));
     }
 
@@ -217,7 +217,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         sb_bp_location.SetLocation (m_opaque_sp->GetLocationAtIndex (index));
     }
 
@@ -235,7 +235,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetEnabled (enable);
     }
 }
@@ -245,7 +245,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->IsEnabled();
     }
     else
@@ -263,7 +263,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetOneShot (one_shot);
     }
 }
@@ -273,7 +273,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->IsOneShot();
     }
     else
@@ -285,7 +285,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->IsInternal();
     }
     else
@@ -303,7 +303,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetIgnoreCount (count);
     }
 }
@@ -313,7 +313,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetCondition (condition);
     }
 }
@@ -323,7 +323,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetConditionText ();
     }
     return nullptr;
@@ -335,7 +335,7 @@
     uint32_t count = 0;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         count = m_opaque_sp->GetHitCount();
     }
 
@@ -353,7 +353,7 @@
     uint32_t count = 0;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         count = m_opaque_sp->GetIgnoreCount();
     }
 
@@ -370,7 +370,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetThreadID (tid);
     }
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -385,7 +385,7 @@
     tid_t tid = LLDB_INVALID_THREAD_ID;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         tid = m_opaque_sp->GetThreadID();
     }
 
@@ -405,7 +405,7 @@
                      static_cast<void*>(m_opaque_sp.get()), index);
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->GetOptions()->GetThreadSpec()->SetIndex (index);
     }
 }
@@ -416,7 +416,7 @@
     uint32_t thread_idx = UINT32_MAX;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
         if (thread_spec != nullptr)
             thread_idx = thread_spec->GetIndex();
@@ -439,7 +439,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->GetOptions()->GetThreadSpec()->SetName (thread_name);
     }
 }
@@ -450,7 +450,7 @@
     const char *name = nullptr;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
         if (thread_spec != nullptr)
             name = thread_spec->GetName();
@@ -472,7 +472,7 @@
                      static_cast<void*>(m_opaque_sp.get()), queue_name);
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name);
     }
 }
@@ -483,7 +483,7 @@
     const char *name = nullptr;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpecNoCreate();
         if (thread_spec)
             name = thread_spec->GetQueueName();
@@ -502,7 +502,7 @@
     size_t num_resolved = 0;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         num_resolved = m_opaque_sp->GetNumResolvedLocations();
     }
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -519,7 +519,7 @@
     size_t num_locs = 0;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         num_locs = m_opaque_sp->GetNumLocations();
     }
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -535,7 +535,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID());
         m_opaque_sp->GetResolverDescription (s.get());
         m_opaque_sp->GetFilterDescription (s.get());
@@ -598,7 +598,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
         m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
     }
@@ -616,7 +616,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
         m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
                                                                                                                                                    callback_function_name);
@@ -635,7 +635,7 @@
     SBError sb_error;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
         Error error =  m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
                                                                                                                                     callback_body_text);
@@ -659,7 +659,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         Error error;  // Think I'm just going to swallow the error here, it's probably more annoying to have to provide it.
         return m_opaque_sp->AddName(new_name, error);
     }
@@ -679,7 +679,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->RemoveName(name_to_remove);
     }
 }
@@ -696,7 +696,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->MatchesName(name);
     }
 
@@ -714,7 +714,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         std::vector<std::string> names_vec;
         m_opaque_sp->GetNames(names_vec);
         for (std::string name : names_vec)
diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp
index 4390e9a..631a32b 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -92,7 +92,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         ret_addr = m_opaque_sp->GetLoadAddress();
     }
 
@@ -104,7 +104,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetEnabled (enabled);
     }
 }
@@ -114,7 +114,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->IsEnabled();
     }
     else
@@ -126,7 +126,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetIgnoreCount();
     }
     else
@@ -138,7 +138,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetIgnoreCount (n);
     }
 }
@@ -148,7 +148,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetCondition (condition);
     }
 }
@@ -158,7 +158,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetConditionText ();
     }
     return NULL;
@@ -176,7 +176,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
         m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
                                                                                                                                      callback_function_name);
@@ -195,7 +195,7 @@
     SBError sb_error;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
         Error error = m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
                                                                                                                                                            callback_body_text);
@@ -212,7 +212,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetThreadID (thread_id);
     }
 }
@@ -223,7 +223,7 @@
     tid_t tid = LLDB_INVALID_THREAD_ID;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetThreadID();
     }
     return tid;
@@ -234,7 +234,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetThreadIndex (index);
     }
 }
@@ -245,7 +245,7 @@
     uint32_t thread_idx = UINT32_MAX;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetThreadIndex();
     }
     return thread_idx;
@@ -257,7 +257,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetThreadName (thread_name);
     }
 }
@@ -267,7 +267,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetThreadName();
     }
     return NULL;
@@ -278,7 +278,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->SetQueueName (queue_name);
     }
 }
@@ -288,7 +288,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->GetQueueName ();
     }
     return NULL;
@@ -299,7 +299,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->IsResolved();
     }
     return false;
@@ -319,7 +319,7 @@
 
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         m_opaque_sp->GetDescription (&strm, level);
         strm.EOL();
     }
@@ -334,7 +334,7 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         return m_opaque_sp->GetID ();
     }
     else
@@ -352,7 +352,7 @@
     SBBreakpoint sb_bp;
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
         *sb_bp = m_opaque_sp->GetBreakpoint ().shared_from_this();
     }
 
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 21f431d..dfa1709 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -398,7 +398,7 @@
         TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
         if (target_sp)
         {
-            Mutex::Locker api_locker(target_sp->GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
             process_sp = target_sp->GetProcessSP();
             sb_process.SetSP(process_sp);
         }
@@ -483,9 +483,9 @@
     if (IsValid())
     {
         TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
-        Mutex::Locker api_locker;
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
-            api_locker.Lock(target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
         m_opaque_ptr->SourceInitFile (false, result.ref());
     }
     else
@@ -508,9 +508,9 @@
     if (IsValid())
     {
         TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
-        Mutex::Locker api_locker;
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
-            api_locker.Lock(target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
         m_opaque_ptr->SourceInitFile (true, result.ref());
     }
     else
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index a1d19d4..3493ad5 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -411,9 +411,9 @@
     if (m_opaque_sp)
     {
         TargetSP target_sp (m_opaque_sp->GetSelectedTarget());
-        Mutex::Locker api_locker;
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
-            api_locker.Lock(target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
 
         SBCommandInterpreter sb_interpreter(GetCommandInterpreter ());
         SBCommandReturnObject result;
@@ -474,8 +474,8 @@
     char stdio_buffer[1024];
     size_t len;
 
-    Mutex::Locker api_locker (target_sp->GetAPIMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+
     if (event_type & (Process::eBroadcastBitSTDOUT | Process::eBroadcastBitStateChanged))
     {
         // Drain stdout when we stop just in case we have any bytes
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 7ca7c16..fa686f6 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -105,8 +105,8 @@
 bool
 SBFrame::IsValid() const
 {
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     Target *target = exe_ctx.GetTargetPtr();
     Process *process = exe_ctx.GetProcessPtr();
@@ -126,8 +126,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBSymbolContext sb_sym_ctx;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -169,8 +169,8 @@
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBModule sb_module;
     ModuleSP module_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -212,8 +212,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBCompileUnit sb_comp_unit;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -253,8 +253,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBFunction sb_function;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -294,8 +294,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBSymbol sb_symbol;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -334,8 +334,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBBlock sb_block;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -374,8 +374,8 @@
 SBFrame::GetFrameBlock () const
 {
     SBBlock sb_block;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -415,8 +415,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBLineEntry sb_line_entry;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -482,8 +482,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     addr_t addr = LLDB_INVALID_ADDRESS;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -523,8 +523,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     bool ret_val = false;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -564,8 +564,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     addr_t addr = LLDB_INVALID_ADDRESS;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -604,8 +604,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     addr_t addr = LLDB_INVALID_ADDRESS;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -644,8 +644,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBAddress sb_addr;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = exe_ctx.GetFramePtr();
     Target *target = exe_ctx.GetTargetPtr();
@@ -704,7 +704,6 @@
 SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dynamic)
 {
     SBValue sb_value;
-    Mutex::Locker api_locker;
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (var_path == nullptr || var_path[0] == '\0')
     {
@@ -712,8 +711,9 @@
             log->Printf ("SBFrame::GetValueForVariablePath called with empty variable path.");
         return sb_value;
     }
-    
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -780,8 +780,8 @@
     }
 
     ValueObjectSP value_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -869,8 +869,8 @@
     }
 
     ValueObjectSP value_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -1048,8 +1048,8 @@
 {
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     const char *disassembly = nullptr;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -1138,8 +1138,8 @@
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBValueList value_list;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -1253,8 +1253,8 @@
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     SBValueList value_list;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -1305,8 +1305,8 @@
 
     SBValue result;
     ValueObjectSP value_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
@@ -1364,8 +1364,8 @@
     Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     Stream &strm = description.ref();
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrame *frame;
     Target *target = exe_ctx.GetTargetPtr();
@@ -1477,8 +1477,8 @@
 
     ValueObjectSP expr_value_sp;
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBFrame()::EvaluateExpression (expr=\"%s\")...", expr);
diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp
index 2d03d53..b5983d7 100644
--- a/lldb/source/API/SBFunction.cpp
+++ b/lldb/source/API/SBFunction.cpp
@@ -156,12 +156,12 @@
     SBInstructionList sb_instructions;
     if (m_opaque_ptr)
     {
-        Mutex::Locker api_locker;
         ExecutionContext exe_ctx;
         TargetSP target_sp (target.GetSP());
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
         {
-            api_locker.Lock (target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
             target_sp->CalculateExecutionContext (exe_ctx);
             exe_ctx.SetProcessSP(target_sp->GetProcessSP());
         }
diff --git a/lldb/source/API/SBInstruction.cpp b/lldb/source/API/SBInstruction.cpp
index a17f3f8d..75ff881 100644
--- a/lldb/source/API/SBInstruction.cpp
+++ b/lldb/source/API/SBInstruction.cpp
@@ -75,12 +75,13 @@
 {
     if (m_opaque_sp)
     {        
-        Mutex::Locker api_locker;
         ExecutionContext exe_ctx;
         TargetSP target_sp (target.GetSP());
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
         {
-            api_locker.Lock (target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
             target_sp->CalculateExecutionContext (exe_ctx);
             exe_ctx.SetProcessSP(target_sp->GetProcessSP());
         }
@@ -94,12 +95,13 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker;
         ExecutionContext exe_ctx;
         TargetSP target_sp (target.GetSP());
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
         {
-            api_locker.Lock (target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
             target_sp->CalculateExecutionContext (exe_ctx);
             exe_ctx.SetProcessSP(target_sp->GetProcessSP());
         }
@@ -113,12 +115,13 @@
 {
     if (m_opaque_sp)
     {
-        Mutex::Locker api_locker;
         ExecutionContext exe_ctx;
         TargetSP target_sp (target.GetSP());
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
         {
-            api_locker.Lock (target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
             target_sp->CalculateExecutionContext (exe_ctx);
             exe_ctx.SetProcessSP(target_sp->GetProcessSP());
         }
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index eea5fdc..1bf3d76 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -163,7 +163,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         if (process_sp->GetState() == eStateConnected)
         {
             if (stop_at_entry)
@@ -209,7 +209,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         if (process_sp->GetState() == eStateConnected)
         {
             ProcessAttachInfo attach_info;
@@ -251,7 +251,7 @@
         Process::StopLocker stop_locker;
 
         const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         num_threads = process_sp->GetThreadList().GetSize(can_update);
     }
 
@@ -272,7 +272,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         thread_sp = process_sp->GetThreadList().GetSelectedThread();
         sb_thread.SetThread (thread_sp);
     }
@@ -295,7 +295,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         thread_sp = process_sp->CreateOSPluginThread(tid, context);
         sb_thread.SetThread (thread_sp);
     }
@@ -465,7 +465,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         return process_sp->GetThreadList().SetSelectedThreadByID (thread.GetThreadID());
     }
     return false;
@@ -480,7 +480,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         ret_val = process_sp->GetThreadList().SetSelectedThreadByID (tid);
     }
 
@@ -501,7 +501,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         ret_val = process_sp->GetThreadList().SetSelectedThreadByIndexID (index_id);
     }
 
@@ -525,7 +525,7 @@
     {
         Process::StopLocker stop_locker;
         const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         thread_sp = process_sp->GetThreadList().GetThreadAtIndex(index, can_update);
         sb_thread.SetThread (thread_sp);
     }
@@ -550,7 +550,7 @@
     {
         Process::StopLocker stop_locker;
 
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         num_queues = process_sp->GetQueueList().GetSize();
     }
 
@@ -572,7 +572,7 @@
     if (process_sp)
     {
         Process::StopLocker stop_locker;
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         queue_sp = process_sp->GetQueueList().GetQueueAtIndex(index);
         sb_queue.SetQueue (queue_sp);
     }
@@ -593,7 +593,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         if (include_expression_stops)
             return process_sp->GetStopID();
         else
@@ -612,7 +612,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         event_sp = process_sp->GetStopEventForStopID(stop_id);
         sb_event.reset(event_sp);
     }
@@ -634,7 +634,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         ret_val = process_sp->GetState();
     }
 
@@ -655,7 +655,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         exit_status = process_sp->GetExitStatus ();
     }
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -674,7 +674,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         exit_desc = process_sp->GetExitDescription ();
     }
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -760,7 +760,7 @@
 
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
 
         if (process_sp->GetTarget().GetDebugger().GetAsyncExecution ())
             sb_error.ref() = process_sp->Resume ();
@@ -790,7 +790,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         sb_error.SetError(process_sp->Destroy(false));
     }
     else
@@ -817,7 +817,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         sb_error.SetError (process_sp->Halt());
     }
     else
@@ -843,7 +843,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         sb_error.SetError (process_sp->Destroy(true));
     }
     else
@@ -877,7 +877,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         sb_error.SetError (process_sp->Detach(keep_stopped));
     }
     else
@@ -893,7 +893,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         sb_error.SetError (process_sp->Signal (signo));
     }
     else
@@ -939,7 +939,7 @@
     {
         Process::StopLocker stop_locker;
         const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         thread_sp = process_sp->GetThreadList().FindThreadByID (tid, can_update);
         sb_thread.SetThread (thread_sp);
     }
@@ -963,7 +963,7 @@
     {
         Process::StopLocker stop_locker;
         const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         thread_sp = process_sp->GetThreadList().FindThreadByIndexID (index_id, can_update);
         sb_thread.SetThread (thread_sp);
     }
@@ -1080,7 +1080,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             bytes_read = process_sp->ReadMemory (addr, dst, dst_len, sb_error.ref());
         }
         else
@@ -1120,7 +1120,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             bytes_read = process_sp->ReadCStringFromMemory (addr, (char *)buf, size, sb_error.ref());
         }
         else
@@ -1149,7 +1149,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             value = process_sp->ReadUnsignedIntegerFromMemory (addr, byte_size, 0, sb_error.ref());
         }
         else
@@ -1178,7 +1178,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             ptr = process_sp->ReadPointerFromMemory (addr, sb_error.ref());
         }
         else
@@ -1218,7 +1218,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             bytes_written = process_sp->WriteMemory (addr, src, src_len, sb_error.ref());
         }
         else
@@ -1282,7 +1282,7 @@
     ProcessSP process_sp(GetSP());
     if (process_sp)
     {
-        Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
         sb_error.SetError(process_sp->GetWatchpointSupportInfo (num));
         if (log)
             log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u",
@@ -1312,7 +1312,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
             return platform_sp->LoadImage (process_sp.get(),
                                            *sb_local_image_spec,
@@ -1341,7 +1341,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
             sb_error.SetError (platform_sp->UnloadImage (process_sp.get(), image_token));
         }
@@ -1369,7 +1369,7 @@
         Process::StopLocker stop_locker;
         if (stop_locker.TryLock(&process_sp->GetRunLock()))
         {
-            Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+            std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
             sb_error.SetError (process_sp->SendEventData (event_data));
         }
         else
@@ -1459,7 +1459,7 @@
         return error;
     }
 
-    Mutex::Locker api_locker(process_sp->GetTarget().GetAPIMutex());
+    std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
 
     if (process_sp->GetState() != eStateStopped)
     {
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index 22d1e54..0dbed12 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -141,12 +141,13 @@
     SBInstructionList sb_instructions;
     if (m_opaque_ptr)
     {
-        Mutex::Locker api_locker;
         ExecutionContext exe_ctx;
         TargetSP target_sp (target.GetSP());
+        std::unique_lock<std::recursive_mutex> lock;
         if (target_sp)
         {
-            api_locker.Lock (target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+
             target_sp->CalculateExecutionContext (exe_ctx);
         }
         if (m_opaque_ptr->ValueIsAddress())
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index df3001b..6a5301b 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -77,7 +77,7 @@
 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 @@
     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 @@
 
     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 @@
 
     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 @@
 
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
         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 @@
     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 @@
     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 @@
     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 @@
     
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
             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)
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 1fc0fdc..0685c17 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -96,8 +96,8 @@
 {
     SBQueue sb_queue;
     QueueSP queue_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (exe_ctx.HasThreadScope())
@@ -130,8 +130,8 @@
 bool
 SBThread::IsValid() const
 {
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     Target *target = exe_ctx.GetTargetPtr();
     Process *process = exe_ctx.GetProcessPtr();
@@ -158,8 +158,8 @@
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     StopReason reason = eStopReasonInvalid;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -187,8 +187,8 @@
 size_t
 SBThread::GetStopReasonDataCount ()
 {
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -247,8 +247,8 @@
 uint64_t
 SBThread::GetStopReasonDataAtIndex (uint32_t idx)
 {
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -369,8 +369,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -501,8 +501,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     ValueObjectSP return_valobj_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -562,8 +562,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     const char *name = NULL;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -592,8 +592,8 @@
 SBThread::GetQueueName () const
 {
     const char *name = NULL;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (exe_ctx.HasThreadScope())
@@ -623,8 +623,8 @@
 SBThread::GetQueueID () const
 {
     queue_id_t id = LLDB_INVALID_QUEUE_ID;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (exe_ctx.HasThreadScope())
@@ -654,8 +654,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     bool success = false;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -760,9 +760,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')",
@@ -819,8 +818,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
@@ -874,8 +873,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::StepOut ()",
@@ -908,8 +907,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (!sb_frame.IsValid())
     {
@@ -961,10 +960,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
-
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)",
@@ -985,9 +982,8 @@
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
@@ -1020,8 +1016,8 @@
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     char path[PATH_MAX];
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     StackFrameSP frame_sp (sb_frame.GetFrameSP());
 
@@ -1164,8 +1160,8 @@
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBError sb_error;
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
     {
@@ -1204,8 +1200,8 @@
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     SBError sb_error;
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)",
@@ -1232,9 +1228,8 @@
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
-
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (log)
         log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)",
@@ -1355,8 +1350,8 @@
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
     uint32_t num_frames = 0;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -1387,8 +1382,8 @@
 
     SBFrame sb_frame;
     StackFrameSP frame_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -1426,8 +1421,8 @@
 
     SBFrame sb_frame;
     StackFrameSP frame_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -1465,8 +1460,8 @@
 
     SBFrame sb_frame;
     StackFrameSP frame_sp;
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
     if (exe_ctx.HasThreadScope())
     {
@@ -1569,8 +1564,8 @@
 SBThread::GetExtendedBacktraceThread (const char *type)
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-    Mutex::Locker api_locker;
-    ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
     SBThread sb_origin_thread;
 
     if (exe_ctx.HasThreadScope())
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index a8584c5..383d39f 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -127,7 +127,7 @@
     }
 
     lldb::ValueObjectSP
-    GetSP (Process::StopLocker &stop_locker, Mutex::Locker &api_locker, Error &error)
+    GetSP(Process::StopLocker &stop_locker, std::unique_lock<std::recursive_mutex> &lock, Error &error)
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
         if (!m_valobj_sp)
@@ -139,11 +139,11 @@
         lldb::ValueObjectSP value_sp = m_valobj_sp;
 
         Target *target = value_sp->GetTargetSP().get();
-        if (target)
-            api_locker.Lock(target->GetAPIMutex());
-        else
+        if (!target)
             return ValueObjectSP();
 
+        lock = std::unique_lock<std::recursive_mutex>(target->GetAPIMutex());
+
         ProcessSP process_sp(value_sp->GetProcessSP());
         if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
         {
@@ -255,13 +255,13 @@
     ValueLocker ()
     {
     }
-    
+
     ValueObjectSP
     GetLockedSP(ValueImpl &in_value)
     {
-        return in_value.GetSP(m_stop_locker, m_api_locker, m_lock_error);
+        return in_value.GetSP(m_stop_locker, m_lock, m_lock_error);
     }
-    
+
     Error &
     GetError()
     {
@@ -270,9 +270,8 @@
     
 private:
     Process::StopLocker m_stop_locker;
-    Mutex::Locker m_api_locker;
+    std::unique_lock<std::recursive_mutex> m_lock;
     Error m_lock_error;
-    
 };
 
 SBValue::SBValue () :
diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp
index 1a1a970..c33d568 100644
--- a/lldb/source/API/SBWatchpoint.cpp
+++ b/lldb/source/API/SBWatchpoint.cpp
@@ -115,7 +115,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         hw_index = watchpoint_sp->GetHardwareIndex();
     }
 
@@ -130,7 +130,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         ret_addr = watchpoint_sp->GetLoadAddress();
     }
 
@@ -145,7 +145,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         watch_size = watchpoint_sp->GetByteSize();
     }
 
@@ -158,7 +158,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         watchpoint_sp->GetTarget().DisableWatchpointByID(watchpoint_sp->GetID());
     }
 }
@@ -169,7 +169,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         return watchpoint_sp->IsEnabled();
     }
     else
@@ -183,7 +183,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         count = watchpoint_sp->GetHitCount();
     }
 
@@ -201,7 +201,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         return watchpoint_sp->GetIgnoreCount();
     }
     else
@@ -214,7 +214,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         watchpoint_sp->SetIgnoreCount (n);
     }
 }
@@ -225,7 +225,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         return watchpoint_sp->GetConditionText ();
     }
     return NULL;
@@ -237,7 +237,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         watchpoint_sp->SetCondition (condition);
     }
 }
@@ -250,7 +250,7 @@
     lldb::WatchpointSP watchpoint_sp(GetSP());
     if (watchpoint_sp)
     {
-        Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+        std::lock_guard<std::recursive_mutex> guard(watchpoint_sp->GetTarget().GetAPIMutex());
         watchpoint_sp->GetDescription (&strm, level);
         strm.EOL();
     }