[Lldb-commits] [lldb] r270024 - second pass over removal of Mutex and Condition

Saleem Abdulrasool via lldb-commits lldb-commits at lists.llvm.org
Wed May 18 22:14:34 PDT 2016


Author: compnerd
Date: Thu May 19 00:13:57 2016
New Revision: 270024

URL: http://llvm.org/viewvc/llvm-project?rev=270024&view=rev
Log:
second pass over removal of Mutex and Condition

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointList.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/WatchpointList.h
    lldb/trunk/include/lldb/Core/IOHandler.h
    lldb/trunk/include/lldb/Core/ModuleList.h
    lldb/trunk/include/lldb/Host/OptionParser.h
    lldb/trunk/include/lldb/Interpreter/CommandObject.h
    lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h
    lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
    lldb/trunk/include/lldb/Symbol/Symtab.h
    lldb/trunk/include/lldb/Symbol/TypeSystem.h
    lldb/trunk/include/lldb/Symbol/UnwindTable.h
    lldb/trunk/include/lldb/Target/ExecutionContext.h
    lldb/trunk/include/lldb/Target/Memory.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/Target/QueueList.h
    lldb/trunk/include/lldb/Target/StackFrame.h
    lldb/trunk/include/lldb/Target/StackFrameList.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/include/lldb/Target/ThreadCollection.h
    lldb/trunk/include/lldb/Target/ThreadList.h
    lldb/trunk/include/lldb/Utility/Iterable.h
    lldb/trunk/source/API/SBAddress.cpp
    lldb/trunk/source/API/SBBreakpoint.cpp
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/API/SBCommandInterpreter.cpp
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBFunction.cpp
    lldb/trunk/source/API/SBInstruction.cpp
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/API/SBSymbol.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/API/SBValue.cpp
    lldb/trunk/source/API/SBWatchpoint.cpp
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Breakpoint/BreakpointList.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/WatchpointList.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
    lldb/trunk/source/Core/IOHandler.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Core/SearchFilter.cpp
    lldb/trunk/source/Host/common/OptionParser.cpp
    lldb/trunk/source/Interpreter/Args.cpp
    lldb/trunk/source/Interpreter/CommandObject.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
    lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
    lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
    lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
    lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp
    lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
    lldb/trunk/source/Symbol/Symtab.cpp
    lldb/trunk/source/Symbol/TypeSystem.cpp
    lldb/trunk/source/Symbol/UnwindTable.cpp
    lldb/trunk/source/Target/ExecutionContext.cpp
    lldb/trunk/source/Target/Language.cpp
    lldb/trunk/source/Target/Memory.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/QueueList.cpp
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/StackFrameList.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/ThreadCollection.cpp
    lldb/trunk/source/Target/ThreadList.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointList.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointList.h Thu May 19 00:13:57 2016
@@ -13,10 +13,11 @@
 // C Includes
 // C++ Includes
 #include <list>
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -116,7 +117,7 @@ public:
     size_t
     GetSize() const 
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_breakpoints.size(); 
     }
 
@@ -193,7 +194,7 @@ public:
     ///   The locker object that is set.
     //------------------------------------------------------------------
     void
-    GetListMutex (lldb_private::Mutex::Locker &locker);
+    GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
 
 protected:
     typedef std::list<lldb::BreakpointSP> bp_collection;
@@ -204,19 +205,20 @@ protected:
     bp_collection::const_iterator
     GetBreakpointIDConstIterator(lldb::break_id_t breakID) const;
 
-    Mutex &
-    GetMutex () const
+    std::recursive_mutex &
+    GetMutex() const
     {
         return m_mutex;
     }
 
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
     bp_collection m_breakpoints;  // The breakpoint list, currently a list.
     lldb::break_id_t m_next_break_id;
     bool m_is_internal;
 
 public:
-    typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, list_adapter> BreakpointIterable;
+    typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, list_adapter, std::recursive_mutex>
+        BreakpointIterable;
     BreakpointIterable
     Breakpoints()
     {

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Thu May 19 00:13:57 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <memory>
+#include <mutex>
 
 // Other libraries and framework includes
 // Project includes
@@ -20,7 +21,6 @@
 #include "lldb/Breakpoint/StoppointLocation.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Core/UserID.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -460,7 +460,8 @@ private:
     std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, nullptr if we're using our breakpoint's options.
     lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
     lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
-    Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
+    std::mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by
+                                  /// multiple processes.
     size_t m_condition_hash; ///< For testing whether the condition source code changed.
 
     void

Modified: lldb/trunk/include/lldb/Breakpoint/WatchpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointList.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/WatchpointList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointList.h Thu May 19 00:13:57 2016
@@ -13,12 +13,13 @@
 // C Includes
 // C++ Includes
 #include <list>
+#include <mutex>
 #include <vector>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Address.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -217,7 +218,7 @@ public:
     size_t
     GetSize() const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_watchpoints.size();
     }
 
@@ -250,7 +251,7 @@ public:
     ///   The locker object that is set.
     //------------------------------------------------------------------
     void
-    GetListMutex (lldb_private::Mutex::Locker &locker);
+    GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
 
 protected:
     typedef std::list<lldb::WatchpointSP> wp_collection;
@@ -266,7 +267,7 @@ protected:
     GetIDConstIterator(lldb::watch_id_t watchID) const;
 
     wp_collection m_watchpoints;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 
     lldb::watch_id_t m_next_wp_id;
 };

Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Thu May 19 00:13:57 2016
@@ -29,7 +29,6 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StringList.h"
 #include "lldb/Core/ValueObjectList.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/Predicate.h"
 
 namespace curses

Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Thu May 19 00:13:57 2016
@@ -14,12 +14,12 @@
 // C++ Includes
 #include <functional>
 #include <list>
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Utility/Iterable.h"
 #include "llvm/ADT/DenseSet.h"
 
@@ -164,13 +164,13 @@ public:
 
     void
     LogUUIDAndPaths (Log *log, const char *prefix_cstr);
-                     
-    Mutex &
-    GetMutex () const
+
+    std::recursive_mutex &
+    GetMutex() const
     {
         return m_modules_mutex;
     }
-    
+
     size_t
     GetIndexForModule (const Module *module) const;
 
@@ -593,12 +593,12 @@ protected:
     // Member variables.
     //------------------------------------------------------------------
     collection m_modules; ///< The collection of modules.
-    mutable Mutex m_modules_mutex;
+    mutable std::recursive_mutex m_modules_mutex;
 
     Notifier* m_notifier;
     
 public:
-    typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter> ModuleIterable;
+    typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter, std::recursive_mutex> ModuleIterable;
     ModuleIterable
     Modules()
     {

Modified: lldb/trunk/include/lldb/Host/OptionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/OptionParser.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/OptionParser.h (original)
+++ lldb/trunk/include/lldb/Host/OptionParser.h Thu May 19 00:13:57 2016
@@ -10,8 +10,8 @@
 #ifndef liblldb_OptionParser_h_
 #define liblldb_OptionParser_h_
 
+#include <mutex>
 #include <string>
-#include "lldb/Host/Mutex.h"
 
 struct option;
 
@@ -39,7 +39,8 @@ public:
         eOptionalArgument
     };
 
-    static void Prepare(Mutex::Locker &locker);
+    static void
+    Prepare(std::unique_lock<std::mutex> &lock);
 
     static void EnableError(bool error);
 

Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Thu May 19 00:13:57 2016
@@ -23,7 +23,6 @@
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Core/StringList.h"
 #include "lldb/Core/Flags.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/ExecutionContext.h"
 
 namespace lldb_private {
@@ -517,7 +516,7 @@ protected:
 
     CommandInterpreter &m_interpreter;
     ExecutionContext m_exe_ctx;
-    Mutex::Locker m_api_locker;
+    std::unique_lock<std::recursive_mutex> m_api_locker;
     std::string m_cmd_name;
     std::string m_cmd_help_short;
     std::string m_cmd_help_long;

Modified: lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h Thu May 19 00:13:57 2016
@@ -10,11 +10,11 @@
 #ifndef liblldb_CompactUnwindInfo_h_
 #define liblldb_CompactUnwindInfo_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/RangeMap.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/UnwindPlan.h"
 #include "lldb/lldb-private.h"
@@ -137,7 +137,7 @@ private:
     lldb::SectionSP             m_section_sp;
     lldb::DataBufferSP          m_section_contents_if_encrypted; // if the binary is encrypted, read the sect contents
                                                                  // out of live memory and cache them here
-    Mutex                       m_mutex;
+    std::mutex m_mutex;
     std::vector<UnwindIndex>    m_indexes;
 
     LazyBool                    m_indexes_computed;         // eLazyBoolYes once we've tried to parse the unwind info

Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Thu May 19 00:13:57 2016
@@ -11,6 +11,7 @@
 #define liblldb_DWARFCallFrameInfo_h_
 
 #include <map>
+#include <mutex>
 
 #include "lldb/Core/AddressRange.h"
 #include "lldb/Core/DataExtractor.h"
@@ -18,7 +19,6 @@
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Core/VMRange.h"
 #include "lldb/Core/dwarf.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/UnwindPlan.h"
 #include "lldb/lldb-private.h"
@@ -155,7 +155,7 @@ private:
 
     FDEEntryMap                 m_fde_index;
     bool                        m_fde_index_initialized;  // only scan the section for FDEs once
-    Mutex                       m_fde_index_mutex;        // and isolate the thread that does it
+    std::mutex m_fde_index_mutex;                         // and isolate the thread that does it
 
     bool                        m_is_eh_frame;
 

Modified: lldb/trunk/include/lldb/Symbol/Symtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symtab.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symtab.h Thu May 19 00:13:57 2016
@@ -11,12 +11,12 @@
 #ifndef liblldb_Symtab_h_
 #define liblldb_Symtab_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/lldb-private.h"
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Core/UniqueCStringMap.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/Symbol.h"
 
 namespace lldb_private {
@@ -50,10 +50,11 @@ public:
             void        Dump(Stream *s, Target *target, SortOrder sort_type);
             void        Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const;
             uint32_t    GetIndexForSymbol (const Symbol *symbol) const;
-            Mutex &     GetMutex ()
-                        {
-                            return m_mutex;
-                        }
+            std::recursive_mutex &
+            GetMutex()
+            {
+                return m_mutex;
+            }
             Symbol *    FindSymbolByID (lldb::user_id_t uid) const;
             Symbol *    SymbolAtIndex (size_t idx);
     const   Symbol *    SymbolAtIndex (size_t idx) const;
@@ -124,7 +125,7 @@ protected:
     UniqueCStringMap<uint32_t> m_basename_to_index;
     UniqueCStringMap<uint32_t> m_method_to_index;
     UniqueCStringMap<uint32_t> m_selector_to_index;
-    mutable Mutex       m_mutex; // Provide thread safety for this symbol table
+    mutable std::recursive_mutex m_mutex; // Provide thread safety for this symbol table
     bool                m_file_addr_to_index_computed:1,
                         m_name_indexes_computed:1;
 private:

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Thu May 19 00:13:57 2016
@@ -14,6 +14,7 @@
 // C++ Includes
 #include <functional>
 #include <map>
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
@@ -24,7 +25,6 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Expression/Expression.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
 
@@ -617,7 +617,7 @@ protected:
         AddToMap (lldb::LanguageType language, lldb::TypeSystemSP const &type_system_sp);
 
         typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
-        mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
+        mutable std::mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
         collection m_map;
         bool m_clear_in_progress;
     };

Modified: lldb/trunk/include/lldb/Symbol/UnwindTable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindTable.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/UnwindTable.h (original)
+++ lldb/trunk/include/lldb/Symbol/UnwindTable.h Thu May 19 00:13:57 2016
@@ -12,9 +12,9 @@
 #define liblldb_UnwindTable_h
 
 #include <map>
+#include <mutex>
 
 #include "lldb/lldb-private.h" 
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -69,7 +69,7 @@ private:
     collection          m_unwinds;
 
     bool                m_initialized;  // delay some initialization until ObjectFile is set up
-    Mutex               m_mutex;
+    std::mutex m_mutex;
 
     std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
     std::unique_ptr<CompactUnwindInfo>  m_compact_unwind_up;

Modified: lldb/trunk/include/lldb/Target/ExecutionContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ExecutionContext.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ExecutionContext.h (original)
+++ lldb/trunk/include/lldb/Target/ExecutionContext.h Thu May 19 00:13:57 2016
@@ -12,11 +12,12 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Target/StackID.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -412,8 +413,8 @@ public:
     
     // These two variants take in a locker, and grab the target, lock the API mutex into locker, then
     // fill in the rest of the shared pointers.
-    ExecutionContext (const ExecutionContextRef &exe_ctx_ref, Mutex::Locker &locker);
-    ExecutionContext (const ExecutionContextRef *exe_ctx_ref, Mutex::Locker &locker);
+    ExecutionContext(const ExecutionContextRef &exe_ctx_ref, std::unique_lock<std::recursive_mutex> &locker);
+    ExecutionContext(const ExecutionContextRef *exe_ctx_ref, std::unique_lock<std::recursive_mutex> &locker);
     //------------------------------------------------------------------
     // Create execution contexts from execution context scopes
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Target/Memory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Memory.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Memory.h (original)
+++ lldb/trunk/include/lldb/Target/Memory.h Thu May 19 00:13:57 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
@@ -20,7 +21,6 @@
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Core/RangeMap.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
     //----------------------------------------------------------------------
@@ -75,7 +75,7 @@ namespace lldb_private {
         //------------------------------------------------------------------
         // Classes that inherit from MemoryCache can see and modify these
         //------------------------------------------------------------------
-        Mutex m_mutex;
+        std::recursive_mutex m_mutex;
         BlockMap m_L1_cache; // A first level memory cache whose chunk sizes vary that will be used only if the memory read fits entirely in a chunk
         BlockMap m_L2_cache; // A memory cache of fixed size chinks (m_L2_cache_line_byte_size bytes in size each)
         InvalidRanges m_invalid_ranges;
@@ -192,7 +192,7 @@ namespace lldb_private {
         // Classes that inherit from MemoryCache can see and modify these
         //------------------------------------------------------------------
         Process &m_process;
-        Mutex m_mutex;
+        std::recursive_mutex m_mutex;
         typedef std::multimap<uint32_t, AllocatedBlockSP> PermissionsToBlockMap;
         PermissionsToBlockMap m_memory_map;
         

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu May 19 00:13:57 2016
@@ -3351,8 +3351,9 @@ protected:
     std::map<uint64_t, uint32_t> m_thread_id_to_index_id_map;
     int                         m_exit_status;          ///< The exit status of the process, or -1 if not set.
     std::string                 m_exit_string;          ///< A textual description of why a process exited.
-    Mutex                       m_exit_status_mutex;    ///< Mutex so m_exit_status m_exit_string can be safely accessed from multiple threads
-    Mutex                       m_thread_mutex;
+    std::mutex
+        m_exit_status_mutex; ///< Mutex so m_exit_status m_exit_string can be safely accessed from multiple threads
+    std::recursive_mutex m_thread_mutex;
     ThreadList                  m_thread_list_real;     ///< The threads for this process as are known to the protocol we are debugging with
     ThreadList                  m_thread_list;          ///< The threads for this process as the user will see them. This is usually the same as
                                                         ///< m_thread_list_real, but might be different if there is an OS plug-in creating memory threads
@@ -3373,11 +3374,11 @@ protected:
     lldb::ABISP                 m_abi_sp;
     lldb::IOHandlerSP           m_process_input_reader;
     Communication               m_stdio_communication;
-    Mutex                       m_stdio_communication_mutex;
+    std::recursive_mutex m_stdio_communication_mutex;
     bool                        m_stdin_forward;           /// Remember if stdin must be forwarded to remote debug server
     std::string                 m_stdout_data;
     std::string                 m_stderr_data;
-    Mutex                       m_profile_data_comm_mutex;
+    std::recursive_mutex m_profile_data_comm_mutex;
     std::vector<std::string>    m_profile_data;
     Predicate<uint32_t>         m_iohandler_sync;
     MemoryCache                 m_memory_cache;

Modified: lldb/trunk/include/lldb/Target/QueueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/QueueList.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/QueueList.h (original)
+++ lldb/trunk/include/lldb/Target/QueueList.h Thu May 19 00:13:57 2016
@@ -10,6 +10,7 @@
 #ifndef liblldb_QueueList_h_
 #define liblldb_QueueList_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/lldb-private.h"
@@ -60,7 +61,7 @@ public:
     GetQueueAtIndex (uint32_t idx);
 
     typedef std::vector<lldb::QueueSP> collection;
-    typedef LockingAdaptedIterable<collection, lldb::QueueSP, vector_adapter> QueueIterable;
+    typedef LockingAdaptedIterable<collection, lldb::QueueSP, vector_adapter, std::mutex> QueueIterable;
 
     //------------------------------------------------------------------
     /// Iterate over the list of queues
@@ -119,8 +120,8 @@ public:
     lldb::QueueSP
     FindQueueByIndexID (uint32_t index_id);
 
-    lldb_private::Mutex &
-    GetMutex ();
+    std::mutex &
+    GetMutex();
 
 protected:
 
@@ -130,7 +131,7 @@ protected:
     Process *m_process; ///< The process that manages this queue list.
     uint32_t m_stop_id; ///< The process stop ID that this queue list is valid for.
     collection m_queues; ///< The queues for this process.
-    Mutex   m_mutex;
+    std::mutex m_mutex;
 
 private:
     QueueList ();

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Thu May 19 00:13:57 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <memory>
+#include <mutex>
 
 // Other libraries and framework includes
 // Project includes
@@ -537,7 +538,7 @@ private:
     lldb::VariableListSP m_variable_list_sp;
     ValueObjectList m_variable_list_value_objects;  // Value objects for each variable in m_variable_list_sp
     StreamString m_disassembly;
-    Mutex m_mutex;
+    std::recursive_mutex m_mutex;
 
     DISALLOW_COPY_AND_ASSIGN (StackFrame);
 };

Modified: lldb/trunk/include/lldb/Target/StackFrameList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrameList.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrameList.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrameList.h Thu May 19 00:13:57 2016
@@ -13,11 +13,11 @@
 // C Includes
 // C++ Includes
 #include <memory>
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/StackFrame.h"
 
 namespace lldb_private {
@@ -135,7 +135,7 @@ protected:
 
     Thread &m_thread;
     lldb::StackFrameListSP m_prev_frames_sp;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
     collection m_frames;
     uint32_t m_selected_frame_idx;
     uint32_t m_concrete_frames_fetched;

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu May 19 00:13:57 2016
@@ -713,8 +713,8 @@ public:
     static const lldb::TargetPropertiesSP &
     GetGlobalProperties();
 
-    Mutex &
-    GetAPIMutex ()
+    std::recursive_mutex &
+    GetAPIMutex()
     {
         return m_mutex;
     }
@@ -1594,7 +1594,8 @@ protected:
     //------------------------------------------------------------------
     Debugger &      m_debugger;
     lldb::PlatformSP m_platform_sp;     ///< The platform for this target.
-    Mutex           m_mutex;            ///< An API mutex that is used by the lldb::SB* classes make the SB interface thread safe
+    std::recursive_mutex
+        m_mutex; ///< An API mutex that is used by the lldb::SB* classes make the SB interface thread safe
     ArchSpec        m_arch;
     ModuleList      m_images;           ///< The list of images for this process (shared libraries and anything dynamically loaded).
     SectionLoadHistory m_section_load_history;

Modified: lldb/trunk/include/lldb/Target/ThreadCollection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadCollection.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadCollection.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadCollection.h Thu May 19 00:13:57 2016
@@ -10,10 +10,10 @@
 #ifndef liblldb_ThreadCollection_h_
 #define liblldb_ThreadCollection_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Utility/Iterable.h"
 
 namespace lldb_private {
@@ -22,8 +22,8 @@ class ThreadCollection
 {
 public:
     typedef std::vector<lldb::ThreadSP> collection;
-    typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter> ThreadIterable;
-    
+    typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter, std::recursive_mutex> ThreadIterable;
+
     ThreadCollection();
     
     ThreadCollection(collection threads);
@@ -53,16 +53,16 @@ public:
     {
         return ThreadIterable(m_threads, GetMutex());
     }
-    
-    virtual Mutex &
+
+    virtual std::recursive_mutex &
     GetMutex()
     {
         return m_mutex;
     }
-    
+
 protected:
     collection m_threads;
-    Mutex m_mutex;
+    std::recursive_mutex m_mutex;
 };
     
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/ThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadList.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadList.h Thu May 19 00:13:57 2016
@@ -10,6 +10,7 @@
 #ifndef liblldb_ThreadList_h_
 #define liblldb_ThreadList_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/lldb-private.h"
@@ -164,9 +165,9 @@ public:
     void
     SetStopID (uint32_t stop_id);
 
-    Mutex &
+    std::recursive_mutex &
     GetMutex() override;
-    
+
     void
     Update (ThreadList &rhs);
     

Modified: lldb/trunk/include/lldb/Utility/Iterable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Iterable.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Iterable.h (original)
+++ lldb/trunk/include/lldb/Utility/Iterable.h Thu May 19 00:13:57 2016
@@ -16,7 +16,6 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private
 {
@@ -207,36 +206,33 @@ public:
         return AdaptedConstIterator<C, E, A>(m_container.end());
     }
 };
-    
-template <typename C, typename E, E (*A)(typename C::const_iterator &)> class LockingAdaptedIterable : public AdaptedIterable<C, E, A>
+
+template <typename C, typename E, E (*A)(typename C::const_iterator &), typename MutexType>
+class LockingAdaptedIterable : public AdaptedIterable<C, E, A>
 {
 public:
-    LockingAdaptedIterable (C &container, Mutex &mutex) :
-        AdaptedIterable<C,E,A>(container),
-        m_mutex(&mutex)
+    LockingAdaptedIterable(C &container, MutexType &mutex) : AdaptedIterable<C, E, A>(container), m_mutex(&mutex)
     {
-        m_mutex->Lock();
+        m_mutex->lock();
     }
-    
-    LockingAdaptedIterable (LockingAdaptedIterable &&rhs) :
-        AdaptedIterable<C,E,A>(rhs),
-        m_mutex(rhs.m_mutex)
+
+    LockingAdaptedIterable(LockingAdaptedIterable &&rhs) : AdaptedIterable<C, E, A>(rhs), m_mutex(rhs.m_mutex)
     {
         rhs.m_mutex = nullptr;
     }
-    
-    ~LockingAdaptedIterable ()
+
+    ~LockingAdaptedIterable()
     {
         if (m_mutex)
-            m_mutex->Unlock();
+            m_mutex->unlock();
     }
-    
+
 private:
-    Mutex *m_mutex = nullptr;
+    MutexType *m_mutex = nullptr;
 
     DISALLOW_COPY_AND_ASSIGN(LockingAdaptedIterable);
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_Iterable_h_

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Thu May 19 00:13:57 2016
@@ -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 @@ SBAddress::GetLoadAddress (const SBTarge
     {
         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());
         }
     }

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Thu May 19 00:13:57 2016
@@ -149,7 +149,7 @@ SBBreakpoint::ClearAllBreakpointSites ()
 {
     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 @@ SBBreakpoint::FindLocationByAddress (add
     {
         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 @@ SBBreakpoint::FindLocationIDByAddress (a
 
     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 @@ SBBreakpoint::FindLocationByID (break_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());
         sb_bp_location.SetLocation (m_opaque_sp->FindLocationByID (bp_loc_id));
     }
 
@@ -217,7 +217,7 @@ SBBreakpoint::GetLocationAtIndex (uint32
 
     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 @@ SBBreakpoint::SetEnabled (bool enable)
 
     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 @@ SBBreakpoint::IsEnabled ()
 {
     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 @@ SBBreakpoint::SetOneShot (bool one_shot)
 
     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 @@ SBBreakpoint::IsOneShot () const
 {
     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 @@ SBBreakpoint::IsInternal ()
 {
     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 @@ SBBreakpoint::SetIgnoreCount (uint32_t c
 
     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 @@ SBBreakpoint::SetCondition (const char *
 {
     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 @@ SBBreakpoint::GetCondition ()
 {
     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 @@ SBBreakpoint::GetHitCount () const
     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 @@ SBBreakpoint::GetIgnoreCount () const
     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 @@ SBBreakpoint::SetThreadID (tid_t tid)
 {
     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 @@ SBBreakpoint::GetThreadID ()
     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 @@ SBBreakpoint::SetThreadIndex (uint32_t i
                      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 @@ SBBreakpoint::GetThreadIndex() const
     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 @@ SBBreakpoint::SetThreadName (const char
 
     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 @@ SBBreakpoint::GetThreadName () const
     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 @@ SBBreakpoint::SetQueueName (const char *
                      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 @@ SBBreakpoint::GetQueueName () const
     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 @@ SBBreakpoint::GetNumResolvedLocations()
     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 @@ SBBreakpoint::GetNumLocations() const
     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 @@ SBBreakpoint::GetDescription (SBStream &
 {
     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 @@ SBBreakpoint::SetCallback (BreakpointHit
 
     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 @@ SBBreakpoint::SetScriptCallbackFunction
 
     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 @@ SBBreakpoint::SetScriptCallbackBody (con
     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 @@ SBBreakpoint::AddName (const char *new_n
 
     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 @@ SBBreakpoint::RemoveName (const char *na
 
     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 @@ SBBreakpoint::MatchesName (const char *n
 
     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 @@ SBBreakpoint::GetNames (SBStringList &na
 
     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)

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Thu May 19 00:13:57 2016
@@ -92,7 +92,7 @@ SBBreakpointLocation::GetLoadAddress ()
 
     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 @@ SBBreakpointLocation::SetEnabled (bool e
 {
     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 @@ SBBreakpointLocation::IsEnabled ()
 {
     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 @@ SBBreakpointLocation::GetIgnoreCount ()
 {
     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 @@ SBBreakpointLocation::SetIgnoreCount (ui
 {
     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 @@ SBBreakpointLocation::SetCondition (cons
 {
     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 @@ SBBreakpointLocation::GetCondition ()
 {
     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 @@ SBBreakpointLocation::SetScriptCallbackF
 
     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 @@ SBBreakpointLocation::SetScriptCallbackB
     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 @@ SBBreakpointLocation::SetThreadID (tid_t
 {
     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 @@ SBBreakpointLocation::GetThreadID ()
     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 @@ SBBreakpointLocation::SetThreadIndex (ui
 {
     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 @@ SBBreakpointLocation::GetThreadIndex() c
     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 @@ SBBreakpointLocation::SetThreadName (con
 {
     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 @@ SBBreakpointLocation::GetThreadName () c
 {
     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 @@ SBBreakpointLocation::SetQueueName (cons
 {
     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 @@ SBBreakpointLocation::GetQueueName () co
 {
     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 @@ SBBreakpointLocation::IsResolved ()
 {
     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 @@ SBBreakpointLocation::GetDescription (SB
 
     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 @@ SBBreakpointLocation::GetID ()
 {
     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 @@ SBBreakpointLocation::GetBreakpoint ()
     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();
     }
 

Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Thu May 19 00:13:57 2016
@@ -398,7 +398,7 @@ SBCommandInterpreter::GetProcess ()
         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 @@ SBCommandInterpreter::SourceInitFileInHo
     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 @@ SBCommandInterpreter::SourceInitFileInCu
     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

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Thu May 19 00:13:57 2016
@@ -411,9 +411,9 @@ SBDebugger::HandleCommand (const char *c
     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 @@ SBDebugger::HandleProcessEvent (const SB
     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

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu May 19 00:13:57 2016
@@ -105,8 +105,8 @@ SBFrame::SetFrameSP (const StackFrameSP
 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 @@ SBFrame::GetSymbolContext (uint32_t reso
 {
     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 @@ SBFrame::GetModule () const
     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 @@ SBFrame::GetCompileUnit () const
 {
     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 @@ SBFrame::GetFunction () const
 {
     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 @@ SBFrame::GetSymbol () const
 {
     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 @@ SBFrame::GetBlock () const
 {
     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 @@ SBBlock
 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 @@ SBFrame::GetLineEntry () const
 {
     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 @@ SBFrame::GetPC () const
 {
     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 @@ SBFrame::SetPC (addr_t new_pc)
 {
     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 @@ SBFrame::GetSP () const
 {
     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 @@ SBFrame::GetFP () const
 {
     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 @@ SBFrame::GetPCAddress () const
 {
     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 @@ lldb::SBValue
 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 @@ SBFrame::GetValueForVariablePath (const
             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 @@ SBFrame::FindVariable (const char *name,
     }
 
     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 @@ SBFrame::FindValue (const char *name, Va
     }
 
     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 @@ SBFrame::Disassemble () const
 {
     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 @@ SBFrame::GetVariables (const lldb::SBVar
     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 @@ SBFrame::GetRegisters ()
     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 @@ SBFrame::FindRegister (const char *name)
 
     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 @@ SBFrame::GetDescription (SBStream &descr
     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 @@ SBFrame::EvaluateExpression (const char
 
     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);

Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Thu May 19 00:13:57 2016
@@ -156,12 +156,12 @@ SBFunction::GetInstructions (SBTarget ta
     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());
         }

Modified: lldb/trunk/source/API/SBInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInstruction.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInstruction.cpp (original)
+++ lldb/trunk/source/API/SBInstruction.cpp Thu May 19 00:13:57 2016
@@ -75,12 +75,13 @@ SBInstruction::GetMnemonic(SBTarget targ
 {
     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 @@ SBInstruction::GetOperands(SBTarget targ
 {
     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 @@ SBInstruction::GetComment(SBTarget targe
 {
     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());
         }

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Thu May 19 00:13:57 2016
@@ -163,7 +163,7 @@ SBProcess::RemoteLaunch (char const **ar
     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 @@ SBProcess::RemoteAttachToProcessWithID (
     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 @@ SBProcess::GetNumThreads ()
         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 @@ SBProcess::GetSelectedThread () const
     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 @@ SBProcess::CreateOSPluginThread (lldb::t
     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 @@ SBProcess::SetSelectedThread (const SBTh
     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 @@ SBProcess::SetSelectedThreadByID (lldb::
     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 @@ SBProcess::SetSelectedThreadByIndexID (u
     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 @@ SBProcess::GetThreadAtIndex (size_t inde
     {
         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 @@ SBProcess::GetNumQueues ()
     {
         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 @@ SBProcess::GetQueueAtIndex (size_t index
     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 @@ SBProcess::GetStopID(bool include_expres
     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 @@ SBProcess::GetStopEventForStopID(uint32_
     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 @@ SBProcess::GetState ()
     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 @@ SBProcess::GetExitStatus ()
     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 @@ SBProcess::GetExitDescription ()
     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 @@ SBProcess::Continue ()
 
     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 @@ SBProcess::Destroy ()
     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 @@ SBProcess::Stop ()
     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 @@ SBProcess::Kill ()
     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 @@ SBProcess::Detach (bool keep_stopped)
     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 @@ SBProcess::Signal (int signo)
     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 @@ SBProcess::GetThreadByID (tid_t tid)
     {
         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 @@ SBProcess::GetThreadByIndexID (uint32_t
     {
         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 @@ SBProcess::ReadMemory (addr_t addr, void
         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 @@ SBProcess::ReadCStringFromMemory (addr_t
         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 @@ SBProcess::ReadUnsignedFromMemory (addr_
         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 @@ SBProcess::ReadPointerFromMemory (addr_t
         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 @@ SBProcess::WriteMemory (addr_t addr, con
         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 @@ SBProcess::GetNumSupportedHardwareWatchp
     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 @@ SBProcess::LoadImage (const lldb::SBFile
         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 @@ SBProcess::UnloadImage (uint32_t image_t
         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 @@ SBProcess::SendEventData (const char *ev
         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 @@ SBProcess::SaveCore(const char *file_nam
         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)
     {

Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Thu May 19 00:13:57 2016
@@ -141,12 +141,13 @@ SBSymbol::GetInstructions (SBTarget targ
     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())

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Thu May 19 00:13:57 2016
@@ -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_launc
 
     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
     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
     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
     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 ad
     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 (co
     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
     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
         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
     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
     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 (add
     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 (S
     
     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
     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
     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 b
     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
     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 w
     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::watc
     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 add
     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
             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)

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Thu May 19 00:13:57 2016
@@ -96,8 +96,8 @@ SBThread::GetQueue () const
 {
     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 @@ SBThread::GetQueue () const
 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 @@ SBThread::GetStopReason()
     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 @@ SBThread::GetStopReason()
 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 @@ SBThread::GetStopReasonDataCount ()
 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 @@ SBThread::GetStopDescription (char *dst,
 {
     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 @@ SBThread::GetStopReturnValue ()
 {
     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 @@ SBThread::GetName () const
 {
     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 @@ const char *
 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 @@ lldb::queue_id_t
 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 @@ SBThread::GetInfoItemByPathAsString (con
 {
     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 @@ SBThread::StepOver (lldb::RunMode stop_o
 {
     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 @@ SBThread::StepInto (const char *target_n
 {
     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 @@ SBThread::StepOut ()
 {
     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 @@ SBThread::StepOutOfFrame (lldb::SBFrame
 {
     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 @@ SBThread::StepInstruction (bool step_ove
 {
     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 @@ SBThread::RunToAddress (lldb::addr_t add
 {
     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 @@ SBThread::StepOverUntil (lldb::SBFrame &
     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 @@ SBThread::StepUsingScriptedThreadPlan (c
     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 @@ SBThread::JumpToLine (lldb::SBFileSpec &
     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 @@ SBThread::ReturnFromFrame (SBFrame &fram
 
     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 @@ SBThread::GetNumFrames ()
     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 @@ SBThread::GetFrameAtIndex (uint32_t idx)
 
     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 @@ SBThread::GetSelectedFrame ()
 
     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 @@ SBThread::SetSelectedFrame (uint32_t idx
 
     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
 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())

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Thu May 19 00:13:57 2016
@@ -127,7 +127,7 @@ public:
     }
 
     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 @@ public:
         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 @@ public:
     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 @@ public:
     
 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 () :

Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Thu May 19 00:13:57 2016
@@ -115,7 +115,7 @@ SBWatchpoint::GetHardwareIndex ()
     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 @@ SBWatchpoint::GetWatchAddress ()
     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 @@ SBWatchpoint::GetWatchSize ()
     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 @@ SBWatchpoint::SetEnabled (bool enabled)
     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 @@ SBWatchpoint::IsEnabled ()
     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 @@ SBWatchpoint::GetHitCount ()
     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 @@ SBWatchpoint::GetIgnoreCount ()
     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 @@ SBWatchpoint::SetIgnoreCount (uint32_t n
     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 @@ SBWatchpoint::GetCondition ()
     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 @@ SBWatchpoint::SetCondition (const char *
     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 @@ SBWatchpoint::GetDescription (SBStream &
     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();
     }

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Thu May 19 00:13:57 2016
@@ -410,8 +410,8 @@ Breakpoint::ModulesChanged (ModuleList &
     if (log)
         log->Printf ("Breakpoint::ModulesChanged: num_modules: %zu load: %i delete_locations: %i\n",
                      module_list.GetSize(), load, delete_locations);
-    
-    Mutex::Locker modules_mutex(module_list.GetMutex());
+
+    std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
     if (load)
     {
         // The logic for handling new modules is:

Modified: lldb/trunk/source/Breakpoint/BreakpointList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointList.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointList.cpp Thu May 19 00:13:57 2016
@@ -18,11 +18,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointList::BreakpointList (bool is_internal) :
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_breakpoints(),
-    m_next_break_id (0),
-    m_is_internal (is_internal)
+BreakpointList::BreakpointList(bool is_internal)
+    : m_mutex(), m_breakpoints(), m_next_break_id(0), m_is_internal(is_internal)
 {
 }
 
@@ -34,7 +31,7 @@ BreakpointList::~BreakpointList()
 break_id_t
 BreakpointList::Add (BreakpointSP &bp_sp, bool notify)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // Internal breakpoint IDs are negative, normal ones are positive
     bp_sp->SetID (m_is_internal ? --m_next_break_id : ++m_next_break_id);
     
@@ -51,7 +48,7 @@ BreakpointList::Add (BreakpointSP &bp_sp
 bool
 BreakpointList::Remove (break_id_t break_id, bool notify)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     bp_collection::iterator pos = GetBreakpointIDIterator(break_id);    // Predicate
     if (pos != m_breakpoints.end())
     {
@@ -71,7 +68,7 @@ BreakpointList::Remove (break_id_t break
 void
 BreakpointList::RemoveInvalidLocations (const ArchSpec &arch)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     for (const auto &bp_sp : m_breakpoints)
         bp_sp->RemoveInvalidLocations(arch);
 }
@@ -80,7 +77,7 @@ BreakpointList::RemoveInvalidLocations (
 void
 BreakpointList::SetEnabledAll (bool enabled)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     for (const auto &bp_sp : m_breakpoints)
         bp_sp->SetEnabled (enabled);
 }
@@ -89,7 +86,7 @@ BreakpointList::SetEnabledAll (bool enab
 void
 BreakpointList::RemoveAll (bool notify)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     ClearAllBreakpointSites ();
 
     if (notify)
@@ -142,7 +139,7 @@ BreakpointList::GetBreakpointIDConstIter
 BreakpointSP
 BreakpointList::FindBreakpointByID (break_id_t break_id)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointSP stop_sp;
     bp_collection::iterator pos = GetBreakpointIDIterator(break_id);
     if (pos != m_breakpoints.end())
@@ -154,7 +151,7 @@ BreakpointList::FindBreakpointByID (brea
 const BreakpointSP
 BreakpointList::FindBreakpointByID (break_id_t break_id) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointSP stop_sp;
     bp_collection::const_iterator pos = GetBreakpointIDConstIterator(break_id);
     if (pos != m_breakpoints.end())
@@ -166,7 +163,7 @@ BreakpointList::FindBreakpointByID (brea
 void
 BreakpointList::Dump (Stream *s) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     s->Printf("%p: ", static_cast<const void*>(this));
     s->Indent();
     s->Printf("BreakpointList with %u Breakpoints:\n", (uint32_t)m_breakpoints.size());
@@ -180,7 +177,7 @@ BreakpointList::Dump (Stream *s) const
 BreakpointSP
 BreakpointList::GetBreakpointAtIndex (size_t i)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointSP stop_sp;
     bp_collection::iterator end = m_breakpoints.end();
     bp_collection::iterator pos;
@@ -196,7 +193,7 @@ BreakpointList::GetBreakpointAtIndex (si
 const BreakpointSP
 BreakpointList::GetBreakpointAtIndex (size_t i) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointSP stop_sp;
     bp_collection::const_iterator end = m_breakpoints.end();
     bp_collection::const_iterator pos;
@@ -212,7 +209,7 @@ BreakpointList::GetBreakpointAtIndex (si
 void
 BreakpointList::UpdateBreakpoints (ModuleList& module_list, bool added, bool delete_locations)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     for (const auto &bp_sp : m_breakpoints)
         bp_sp->ModulesChanged (module_list, added, delete_locations);
 
@@ -221,7 +218,7 @@ BreakpointList::UpdateBreakpoints (Modul
 void
 BreakpointList::UpdateBreakpointsWhenModuleIsReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     for (const auto &bp_sp : m_breakpoints)
         bp_sp->ModuleReplaced (old_module_sp, new_module_sp);
 
@@ -230,14 +227,14 @@ BreakpointList::UpdateBreakpointsWhenMod
 void
 BreakpointList::ClearAllBreakpointSites ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     for (const auto &bp_sp : m_breakpoints)
         bp_sp->ClearAllBreakpointSites ();
 
 }
 
 void
-BreakpointList::GetListMutex (Mutex::Locker &locker)
+BreakpointList::GetListMutex(std::unique_lock<std::recursive_mutex> &lock)
 {
-    return locker.Lock (m_mutex);
+    lock = std::unique_lock<std::recursive_mutex>(m_mutex);
 }

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Thu May 19 00:13:57 2016
@@ -33,36 +33,29 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointLocation::BreakpointLocation
-(
-    break_id_t loc_id,
-    Breakpoint &owner,
-    const Address &addr,
-    lldb::tid_t tid,
-    bool hardware,
-    bool check_for_resolver
-) :
-    StoppointLocation (loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware),
-    m_being_created(true),
-    m_should_resolve_indirect_functions (false),
-    m_is_reexported (false),
-    m_is_indirect (false),
-    m_address (addr),
-    m_owner (owner),
-    m_options_ap (),
-    m_bp_site_sp (),
-    m_condition_mutex ()
+BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner, const Address &addr, lldb::tid_t tid,
+                                       bool hardware, bool check_for_resolver)
+    : StoppointLocation(loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()), hardware),
+      m_being_created(true),
+      m_should_resolve_indirect_functions(false),
+      m_is_reexported(false),
+      m_is_indirect(false),
+      m_address(addr),
+      m_owner(owner),
+      m_options_ap(),
+      m_bp_site_sp(),
+      m_condition_mutex()
 {
     if (check_for_resolver)
     {
         Symbol *symbol = m_address.CalculateSymbolContextSymbol();
         if (symbol && symbol->IsIndirect())
         {
-            SetShouldResolveIndirectFunctions (true);
+            SetShouldResolveIndirectFunctions(true);
         }
     }
-    
-    SetThreadID (tid);
+
+    SetThreadID(tid);
     m_being_created = false;
 }
 
@@ -267,9 +260,9 @@ bool
 BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
 {
     Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
- 
-    Mutex::Locker evaluation_locker(m_condition_mutex);
-    
+
+    std::lock_guard<std::mutex> guard(m_condition_mutex);
+
     size_t condition_hash;
     const char *condition_text = GetConditionText(&condition_hash);
     

Modified: lldb/trunk/source/Breakpoint/WatchpointList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointList.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointList.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointList.cpp Thu May 19 00:13:57 2016
@@ -18,10 +18,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-WatchpointList::WatchpointList() :
-    m_watchpoints (),
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_next_wp_id (0)
+WatchpointList::WatchpointList() : m_watchpoints(), m_mutex(), m_next_wp_id(0)
 {
 }
 
@@ -33,7 +30,7 @@ WatchpointList::~WatchpointList()
 lldb::watch_id_t
 WatchpointList::Add (const WatchpointSP &wp_sp, bool notify)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     wp_sp->SetID(++m_next_wp_id);
     m_watchpoints.push_back(wp_sp);
     if (notify)
@@ -54,7 +51,7 @@ WatchpointList::Dump (Stream *s) const
 void
 WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     s->Printf("%p: ", static_cast<const void*>(this));
     //s->Indent();
     s->Printf("WatchpointList with %" PRIu64 " Watchpoints:\n",
@@ -70,7 +67,7 @@ const WatchpointSP
 WatchpointList::FindByAddress (lldb::addr_t addr) const
 {
     WatchpointSP wp_sp;
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_watchpoints.empty())
     {
         wp_collection::const_iterator pos, end = m_watchpoints.end();
@@ -93,7 +90,7 @@ const WatchpointSP
 WatchpointList::FindBySpec (std::string spec) const
 {
     WatchpointSP wp_sp;
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_watchpoints.empty())
     {
         wp_collection::const_iterator pos, end = m_watchpoints.end();
@@ -142,7 +139,7 @@ WatchpointSP
 WatchpointList::FindByID (lldb::watch_id_t watch_id) const
 {
     WatchpointSP wp_sp;
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     wp_collection::const_iterator pos = GetIDConstIterator(watch_id);
     if (pos != m_watchpoints.end())
         wp_sp = *pos;
@@ -175,7 +172,7 @@ WatchpointList::FindIDBySpec (std::strin
 WatchpointSP
 WatchpointList::GetByIndex (uint32_t i)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     WatchpointSP wp_sp;
     if (i < m_watchpoints.size())
     {
@@ -189,7 +186,7 @@ WatchpointList::GetByIndex (uint32_t i)
 const WatchpointSP
 WatchpointList::GetByIndex (uint32_t i) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     WatchpointSP wp_sp;
     if (i < m_watchpoints.size())
     {
@@ -213,7 +210,7 @@ WatchpointList::GetWatchpointIDs() const
 bool
 WatchpointList::Remove (lldb::watch_id_t watch_id, bool notify)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     wp_collection::iterator pos = GetIDIterator(watch_id);
     if (pos != m_watchpoints.end())
     {
@@ -234,7 +231,7 @@ uint32_t
 WatchpointList::GetHitCount () const
 {
     uint32_t hit_count = 0;
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     wp_collection::const_iterator pos, end = m_watchpoints.end();
     for (pos = m_watchpoints.begin(); pos != end; ++pos)
         hit_count += (*pos)->GetHitCount();
@@ -261,7 +258,7 @@ WatchpointList::ShouldStop (StoppointCal
 void
 WatchpointList::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     wp_collection::iterator pos, end = m_watchpoints.end();
 
     for (pos = m_watchpoints.begin(); pos != end; ++pos)
@@ -274,7 +271,7 @@ WatchpointList::GetDescription (Stream *
 void
 WatchpointList::SetEnabledAll (bool enabled)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     wp_collection::iterator pos, end = m_watchpoints.end();
     for (pos = m_watchpoints.begin(); pos != end; ++pos)
@@ -284,7 +281,7 @@ WatchpointList::SetEnabledAll (bool enab
 void
 WatchpointList::RemoveAll (bool notify)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (notify)
     {
         
@@ -305,7 +302,7 @@ WatchpointList::RemoveAll (bool notify)
 }
 
 void
-WatchpointList::GetListMutex (Mutex::Locker &locker)
+WatchpointList::GetListMutex(std::unique_lock<std::recursive_mutex> &lock)
 {
-    return locker.Lock (m_mutex);
+    lock = std::unique_lock<std::recursive_mutex>(m_mutex);
 }

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu May 19 00:13:57 2016
@@ -1092,9 +1092,9 @@ protected:
             return false;
         }
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
+
         BreakpointIDList valid_bp_ids;
 
         CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
@@ -1222,8 +1222,8 @@ protected:
             return false;
         }
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
 
         const BreakpointList &breakpoints = target->GetBreakpointList();
 
@@ -1339,8 +1339,8 @@ protected:
             return false;
         }
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
 
         const BreakpointList &breakpoints = target->GetBreakpointList();
         size_t num_breakpoints = breakpoints.GetSize();
@@ -1523,8 +1523,8 @@ protected:
         }
 
         const BreakpointList &breakpoints = target->GetBreakpointList(m_options.m_internal);
-        Mutex::Locker locker;
-        target->GetBreakpointList(m_options.m_internal).GetListMutex(locker);
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList(m_options.m_internal).GetListMutex(lock);
 
         size_t num_breakpoints = breakpoints.GetSize();
 
@@ -1713,8 +1713,8 @@ protected:
         if (m_options.m_line_num != 0)
             break_type = eClearTypeFileAndLine;
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
 
         BreakpointList &breakpoints = target->GetBreakpointList();
         size_t num_breakpoints = breakpoints.GetSize();
@@ -1901,9 +1901,9 @@ protected:
             return false;
         }
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
+
         const BreakpointList &breakpoints = target->GetBreakpointList();
 
         size_t num_breakpoints = breakpoints.GetSize();
@@ -2118,9 +2118,9 @@ protected:
             return false;
         }
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
+
         const BreakpointList &breakpoints = target->GetBreakpointList();
 
         size_t num_breakpoints = breakpoints.GetSize();
@@ -2211,9 +2211,9 @@ protected:
             return false;
         }
 
-        Mutex::Locker locker;
-        target->GetBreakpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetBreakpointList().GetListMutex(lock);
+
         const BreakpointList &breakpoints = target->GetBreakpointList();
 
         size_t num_breakpoints = breakpoints.GetSize();
@@ -2292,9 +2292,9 @@ protected:
         if (m_name_options.m_name.OptionWasSet())
         {
             const char *name = m_name_options.m_name.GetCurrentValue();
-            Mutex::Locker locker;
-            target->GetBreakpointList().GetListMutex(locker);
-            
+            std::unique_lock<std::recursive_mutex> lock;
+            target->GetBreakpointList().GetListMutex(lock);
+
             BreakpointList &breakpoints = target->GetBreakpointList();
             for (BreakpointSP bp_sp : breakpoints.Breakpoints())
             {

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu May 19 00:13:57 2016
@@ -733,7 +733,7 @@ protected:
             }
             
             {  // Scope for thread list mutex:
-                Mutex::Locker locker (process->GetThreadList().GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex());
                 const uint32_t num_threads = process->GetThreadList().GetSize();
 
                 // Set the actions that the threads should each take when resuming

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu May 19 00:13:57 2016
@@ -1548,7 +1548,7 @@ static size_t
 DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list)
 {
     size_t num_dumped = 0;
-    Mutex::Locker modules_locker(module_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
     const size_t num_modules = module_list.GetSize();
     if (num_modules > 0)
     {
@@ -2302,7 +2302,7 @@ protected:
             if (command.GetArgumentCount() == 0)
             {
                 // Dump all sections for all modules images
-                Mutex::Locker modules_locker(target->GetImages().GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(target->GetImages().GetMutex());
                 const size_t num_modules = target->GetImages().GetSize();
                 if (num_modules > 0)
                 {
@@ -2532,7 +2532,7 @@ protected:
             {
                 // Dump all sections for all modules images
                 const ModuleList &target_modules = target->GetImages();
-                Mutex::Locker modules_locker (target_modules.GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
                 const size_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
                 {
@@ -2633,7 +2633,7 @@ protected:
                 FileSpec file_spec(arg_cstr, false);
 
                 const ModuleList &target_modules = target->GetImages();
-                Mutex::Locker modules_locker(target_modules.GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
                 const size_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
                 {
@@ -3296,7 +3296,6 @@ protected:
             // Otherwise it will lock the AllocationModuleCollectionMutex when accessing
             // the global module list directly.
             std::unique_lock<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex(), std::defer_lock);
-            Mutex::Locker locker;
 
             const ModuleList *module_list_ptr = nullptr;
             const size_t argc = command.GetArgumentCount();
@@ -3333,10 +3332,11 @@ protected:
                 module_list_ptr = &module_list;
             }
 
+            std::unique_lock<std::recursive_mutex> lock;
             if (module_list_ptr != nullptr)
             {
-                assert(use_global_module_list == false && "locking violation");
-                locker.Lock(module_list_ptr->GetMutex());
+                lock = std::unique_lock<std::recursive_mutex>(module_list_ptr->GetMutex());
+
                 num_modules = module_list_ptr->GetSize();
             }
 
@@ -4239,7 +4239,7 @@ protected:
                 // Dump all sections for all other modules
 
                 const ModuleList &target_modules = target->GetImages();
-                Mutex::Locker modules_locker(target_modules.GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
                 const size_t num_modules = target_modules.GetSize();
                 if (num_modules > 0)
                 {

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Thu May 19 00:13:57 2016
@@ -87,7 +87,7 @@ public:
             const size_t num_args = command.GetArgumentCount();
             Process *process = m_exe_ctx.GetProcessPtr();
 
-            Mutex::Locker locker (process->GetThreadList().GetMutex());
+            std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex());
 
             for (size_t i = 0; i < num_args; i++)
             {
@@ -859,7 +859,7 @@ public:
                 // These two lines appear at the beginning of both blocks in
                 // this if..else, but that is because we need to release the
                 // lock before calling process->Resume below.
-                Mutex::Locker locker (process->GetThreadList().GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex());
                 const uint32_t num_threads = process->GetThreadList().GetSize();
                 std::vector<Thread *> resume_threads;
                 for (uint32_t i = 0; i < argc; ++i)
@@ -932,7 +932,7 @@ public:
                 // These two lines appear at the beginning of both blocks in
                 // this if..else, but that is because we need to release the
                 // lock before calling process->Resume below.
-                Mutex::Locker locker (process->GetThreadList().GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex());
                 const uint32_t num_threads = process->GetThreadList().GetSize();
                 Thread *current_thread = GetDefaultThread();
                 if (current_thread == nullptr)

Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Thu May 19 00:13:57 2016
@@ -265,8 +265,9 @@ protected:
         }
 
         const WatchpointList &watchpoints = target->GetWatchpointList();
-        Mutex::Locker locker;
-        target->GetWatchpointList().GetListMutex(locker);
+
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetWatchpointList().GetListMutex(lock);
 
         size_t num_watchpoints = watchpoints.GetSize();
 
@@ -369,8 +370,8 @@ protected:
         if (!CheckTargetForWatchpointOperations(target, result))
             return false;
 
-        Mutex::Locker locker;
-        target->GetWatchpointList().GetListMutex(locker);
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetWatchpointList().GetListMutex(lock);
 
         const WatchpointList &watchpoints = target->GetWatchpointList();
 
@@ -444,8 +445,8 @@ protected:
         if (!CheckTargetForWatchpointOperations(target, result))
             return false;
 
-        Mutex::Locker locker;
-        target->GetWatchpointList().GetListMutex(locker);
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetWatchpointList().GetListMutex(lock);
 
         const WatchpointList &watchpoints = target->GetWatchpointList();
         size_t num_watchpoints = watchpoints.GetSize();
@@ -525,9 +526,9 @@ protected:
         if (!CheckTargetForWatchpointOperations(target, result))
             return false;
 
-        Mutex::Locker locker;
-        target->GetWatchpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetWatchpointList().GetListMutex(lock);
+
         const WatchpointList &watchpoints = target->GetWatchpointList();
 
         size_t num_watchpoints = watchpoints.GetSize();
@@ -666,9 +667,9 @@ protected:
         if (!CheckTargetForWatchpointOperations(target, result))
             return false;
 
-        Mutex::Locker locker;
-        target->GetWatchpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetWatchpointList().GetListMutex(lock);
+
         const WatchpointList &watchpoints = target->GetWatchpointList();
 
         size_t num_watchpoints = watchpoints.GetSize();
@@ -819,9 +820,9 @@ protected:
         if (!CheckTargetForWatchpointOperations(target, result))
             return false;
 
-        Mutex::Locker locker;
-        target->GetWatchpointList().GetListMutex(locker);
-        
+        std::unique_lock<std::recursive_mutex> lock;
+        target->GetWatchpointList().GetListMutex(lock);
+
         const WatchpointList &watchpoints = target->GetWatchpointList();
 
         size_t num_watchpoints = watchpoints.GetSize();

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Thu May 19 00:13:57 2016
@@ -3330,7 +3330,7 @@ public:
                 if (thread_sp)
                 {
                     ThreadList &thread_list = thread_sp->GetProcess()->GetThreadList();
-                    Mutex::Locker locker (thread_list.GetMutex());
+                    std::lock_guard<std::recursive_mutex> guard(thread_list.GetMutex());
                     ThreadSP selected_thread_sp = thread_list.GetSelectedThread();
                     if (selected_thread_sp->GetID() != thread_sp->GetID())
                     {
@@ -3412,7 +3412,7 @@ public:
                 
                 TreeItem t (&item, *m_thread_delegate_sp, false);
                 ThreadList &threads = process_sp->GetThreadList();
-                Mutex::Locker locker (threads.GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(threads.GetMutex());
                 size_t num_threads = threads.GetSize();
                 item.Resize (num_threads, t);
                 for (size_t i = 0; i < num_threads; ++i)
@@ -4431,7 +4431,7 @@ public:
                             submenus.erase (submenus.begin() + 8, submenus.end());
                         
                         ThreadList &threads = process->GetThreadList();
-                        Mutex::Locker locker (threads.GetMutex());
+                        std::lock_guard<std::recursive_mutex> guard(threads.GetMutex());
                         size_t num_threads = threads.GetSize();
                         for (size_t i = 0; i < num_threads; ++i)
                         {

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Thu May 19 00:13:57 2016
@@ -28,27 +28,18 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ModuleList::ModuleList() :
-    m_modules(),
-    m_modules_mutex (Mutex::eMutexTypeRecursive),
-    m_notifier(nullptr)
+ModuleList::ModuleList() : m_modules(), m_modules_mutex(), m_notifier(nullptr)
 {
 }
 
-ModuleList::ModuleList(const ModuleList& rhs) :
-    m_modules(),
-    m_modules_mutex (Mutex::eMutexTypeRecursive),
-    m_notifier(nullptr)
+ModuleList::ModuleList(const ModuleList &rhs) : m_modules(), m_modules_mutex(), m_notifier(nullptr)
 {
-    Mutex::Locker lhs_locker(m_modules_mutex);
-    Mutex::Locker rhs_locker(rhs.m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
     m_modules = rhs.m_modules;
 }
 
-ModuleList::ModuleList (ModuleList::Notifier* notifier) :
-    m_modules(),
-    m_modules_mutex (Mutex::eMutexTypeRecursive),
-    m_notifier(notifier)
+ModuleList::ModuleList(ModuleList::Notifier *notifier) : m_modules(), m_modules_mutex(), m_notifier(notifier)
 {
 }
 
@@ -69,14 +60,14 @@ ModuleList::operator= (const ModuleList&
         // avoids priority inversion.
         if (uintptr_t(this) > uintptr_t(&rhs))
         {
-            Mutex::Locker lhs_locker(m_modules_mutex);
-            Mutex::Locker rhs_locker(rhs.m_modules_mutex);
+            std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
+            std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
             m_modules = rhs.m_modules;
         }
         else
         {
-            Mutex::Locker rhs_locker(rhs.m_modules_mutex);
-            Mutex::Locker lhs_locker(m_modules_mutex);
+            std::lock_guard<std::recursive_mutex> lhs_guard(m_modules_mutex);
+            std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_modules_mutex);
             m_modules = rhs.m_modules;
         }
     }
@@ -90,7 +81,7 @@ ModuleList::AppendImpl (const ModuleSP &
 {
     if (module_sp)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         m_modules.push_back(module_sp);
         if (use_notifier && m_notifier)
             m_notifier->ModuleAdded(*this, module_sp);
@@ -108,7 +99,7 @@ ModuleList::ReplaceEquivalent (const Mod
 {
     if (module_sp)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
 
         // First remove any equivalent modules. Equivalent modules are modules
         // whose path, platform path and architecture match.
@@ -134,7 +125,7 @@ ModuleList::AppendIfNeeded (const Module
 {
     if (module_sp)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -172,7 +163,7 @@ ModuleList::RemoveImpl (const ModuleSP &
 {
     if (module_sp)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -220,7 +211,7 @@ ModuleList::RemoveIfOrphaned (const Modu
 {
     if (module_ptr)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -242,16 +233,16 @@ ModuleList::RemoveIfOrphaned (const Modu
 size_t
 ModuleList::RemoveOrphans (bool mandatory)
 {
-    Mutex::Locker locker;
-    
+    std::unique_lock<std::recursive_mutex> lock(m_modules_mutex, std::defer_lock);
+
     if (mandatory)
     {
-        locker.Lock (m_modules_mutex);
+        lock.lock();
     }
     else
     {
         // Not mandatory, remove orphans if we can get the mutex
-        if (!locker.TryLock(m_modules_mutex))
+        if (!lock.try_lock())
             return 0;
     }
     collection::iterator pos = m_modules.begin();
@@ -274,7 +265,7 @@ ModuleList::RemoveOrphans (bool mandator
 size_t
 ModuleList::Remove (ModuleList &module_list)
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     size_t num_removed = 0;
     collection::iterator pos, end = module_list.m_modules.end();
     for (pos = module_list.m_modules.begin(); pos != end; ++pos)
@@ -301,7 +292,7 @@ ModuleList::Destroy()
 void
 ModuleList::ClearImpl (bool use_notifier)
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     if (use_notifier && m_notifier)
         m_notifier->WillClearList(*this);
     m_modules.clear();
@@ -310,7 +301,7 @@ ModuleList::ClearImpl (bool use_notifier
 Module*
 ModuleList::GetModulePointerAtIndex (size_t idx) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     return GetModulePointerAtIndexUnlocked(idx);
 }
 
@@ -325,7 +316,7 @@ ModuleList::GetModulePointerAtIndexUnloc
 ModuleSP
 ModuleList::GetModuleAtIndex(size_t idx) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     return GetModuleAtIndexUnlocked(idx);
 }
 
@@ -361,8 +352,8 @@ ModuleList::FindFunctions (const ConstSt
                                               lookup_name,
                                               lookup_name_type_mask,
                                               match_name_after_lookup);
-    
-        Mutex::Locker locker(m_modules_mutex);
+
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -398,7 +389,7 @@ ModuleList::FindFunctions (const ConstSt
     }
     else
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -425,8 +416,8 @@ ModuleList::FindFunctionSymbols (const C
                                               lookup_name,
                                               lookup_name_type_mask,
                                               match_name_after_lookup);
-    
-        Mutex::Locker locker(m_modules_mutex);
+
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -458,7 +449,7 @@ ModuleList::FindFunctionSymbols (const C
     }
     else
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -478,7 +469,7 @@ ModuleList::FindFunctions(const RegularE
 {
     const size_t old_size = sc_list.GetSize();
 
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -495,8 +486,8 @@ ModuleList::FindCompileUnits (const File
 {
     if (!append)
         sc_list.Clear();
-    
-    Mutex::Locker locker(m_modules_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -513,7 +504,7 @@ ModuleList::FindGlobalVariables (const C
                                  VariableList& variable_list) const
 {
     size_t initial_size = variable_list.GetSize();
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -529,7 +520,7 @@ ModuleList::FindGlobalVariables (const R
                                  VariableList& variable_list) const
 {
     size_t initial_size = variable_list.GetSize();
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -544,7 +535,7 @@ ModuleList::FindSymbolsWithNameAndType (
                                         SymbolContextList &sc_list,
                                         bool append) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     if (!append)
         sc_list.Clear();
     size_t initial_size = sc_list.GetSize();
@@ -561,7 +552,7 @@ ModuleList::FindSymbolsMatchingRegExAndT
                                              SymbolContextList &sc_list,
                                              bool append) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     if (!append)
         sc_list.Clear();
     size_t initial_size = sc_list.GetSize();
@@ -577,7 +568,7 @@ ModuleList::FindModules (const ModuleSpe
 {
     size_t existing_matches = matching_module_list.GetSize();
 
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -595,7 +586,7 @@ ModuleList::FindModule (const Module *mo
 
     // Scope for "locker"
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
 
         for (pos = m_modules.begin(); pos != end; ++pos)
@@ -617,7 +608,7 @@ ModuleList::FindModule (const UUID &uuid
     
     if (uuid.IsValid())
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         
         for (pos = m_modules.begin(); pos != end; ++pos)
@@ -635,7 +626,7 @@ ModuleList::FindModule (const UUID &uuid
 size_t
 ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeList& types) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
 
     size_t total_matches = 0;
     collection::const_iterator pos, end = m_modules.end();
@@ -677,7 +668,7 @@ ModuleList::FindTypes (const SymbolConte
 bool
 ModuleList::FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -693,7 +684,7 @@ ModuleList::FindAddressesForLine (const
                                   Function *function,
                                   std::vector<Address> &output_local, std::vector<Address> &output_extern)
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -705,7 +696,7 @@ ModuleSP
 ModuleList::FindFirstModule (const ModuleSpec &module_spec) const
 {
     ModuleSP module_sp;
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -722,7 +713,7 @@ ModuleList::GetSize() const
 {
     size_t size = 0;
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         size = m_modules.size();
     }
     return size;
@@ -731,11 +722,11 @@ ModuleList::GetSize() const
 void
 ModuleList::Dump(Stream *s) const
 {
-//  s.Printf("%.*p: ", (int)sizeof(void*) * 2, this);
-//  s.Indent();
-//  s << "ModuleList\n";
+    //  s.Printf("%.*p: ", (int)sizeof(void*) * 2, this);
+    //  s.Indent();
+    //  s << "ModuleList\n";
 
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -747,8 +738,8 @@ void
 ModuleList::LogUUIDAndPaths (Log *log, const char *prefix_cstr)
 {
     if (log != nullptr)
-    {   
-        Mutex::Locker locker(m_modules_mutex);
+    {
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, begin = m_modules.begin(), end = m_modules.end();
         for (pos = begin; pos != end; ++pos)
         {
@@ -767,7 +758,7 @@ ModuleList::LogUUIDAndPaths (Log *log, c
 bool
 ModuleList::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -792,7 +783,7 @@ ModuleList::ResolveSymbolContextForAddre
     }
     else
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos, end = m_modules.end();
         for (pos = m_modules.begin(); pos != end; ++pos)
         {
@@ -821,7 +812,7 @@ ModuleList::ResolveSymbolContextForFileP
 uint32_t
 ModuleList::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     collection::const_iterator pos, end = m_modules.end();
     for (pos = m_modules.begin(); pos != end; ++pos)
     {
@@ -836,7 +827,7 @@ ModuleList::GetIndexForModule (const Mod
 {
     if (module)
     {
-        Mutex::Locker locker(m_modules_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
         collection::const_iterator pos;
         collection::const_iterator begin = m_modules.begin();
         collection::const_iterator end = m_modules.end();
@@ -896,7 +887,7 @@ ModuleList::GetSharedModule(const Module
                             bool always_create)
 {
     ModuleList &shared_module_list = GetSharedModuleList ();
-    Mutex::Locker locker(shared_module_list.m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(shared_module_list.m_modules_mutex);
     char path[PATH_MAX];
 
     Error error;
@@ -1175,7 +1166,7 @@ ModuleList::LoadScriptingResourcesInTarg
 {
     if (!target)
         return false;
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     for (auto module : m_modules)
     {
         Error error;
@@ -1202,7 +1193,7 @@ ModuleList::LoadScriptingResourcesInTarg
 void
 ModuleList::ForEach (std::function <bool (const ModuleSP &module_sp)> const &callback) const
 {
-    Mutex::Locker locker(m_modules_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     for (const auto &module : m_modules)
     {
         // If the callback returns false, then stop iterating and break out

Modified: lldb/trunk/source/Core/SearchFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Core/SearchFilter.cpp (original)
+++ lldb/trunk/source/Core/SearchFilter.cpp Thu May 19 00:13:57 2016
@@ -130,7 +130,7 @@ SearchFilter::SearchInModuleList (Search
         searcher.SearchCallback(*this, empty_sc, nullptr, false);
     else
     {
-        Mutex::Locker modules_locker(modules.GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(modules.GetMutex());
         const size_t numModules = modules.GetSize();
 
         for (size_t i = 0; i < numModules; i++)
@@ -172,8 +172,8 @@ SearchFilter::DoModuleIteration (const S
         else
         {
             const ModuleList &target_images = m_target_sp->GetImages();
-            Mutex::Locker modules_locker(target_images.GetMutex());
-            
+            std::lock_guard<std::recursive_mutex> guard(target_images.GetMutex());
+
             size_t n_modules = target_images.GetSize();
             for (size_t i = 0; i < n_modules; i++)
             {
@@ -363,8 +363,8 @@ SearchFilterByModule::Search (Searcher &
     // find the ones that match the file name.
 
     const ModuleList &target_modules = m_target_sp->GetImages();
-    Mutex::Locker modules_locker (target_modules.GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
+
     const size_t num_modules = target_modules.GetSize ();
     for (size_t i = 0; i < num_modules; i++)
     {
@@ -502,8 +502,8 @@ SearchFilterByModuleList::Search (Search
     // find the ones that match the file name.
 
     const ModuleList &target_modules = m_target_sp->GetImages();
-    Mutex::Locker modules_locker (target_modules.GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
+
     const size_t num_modules = target_modules.GetSize ();
     for (size_t i = 0; i < num_modules; i++)
     {
@@ -656,8 +656,8 @@ SearchFilterByModuleListAndCU::Search (S
 
     ModuleList matching_modules;
     const ModuleList &target_images = m_target_sp->GetImages();
-    Mutex::Locker modules_locker(target_images.GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(target_images.GetMutex());
+
     const size_t num_modules = target_images.GetSize ();
     bool no_modules_in_filter = m_module_spec_list.GetSize() == 0;
     for (size_t i = 0; i < num_modules; i++)

Modified: lldb/trunk/source/Host/common/OptionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/OptionParser.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/OptionParser.cpp (original)
+++ lldb/trunk/source/Host/common/OptionParser.cpp Thu May 19 00:13:57 2016
@@ -16,10 +16,10 @@
 using namespace lldb_private;
 
 void
-OptionParser::Prepare(Mutex::Locker &locker)
+OptionParser::Prepare(std::unique_lock<std::mutex> &lock)
 {
-    static Mutex g_mutex(Mutex::eMutexTypeNormal);
-    locker.Lock(g_mutex);
+    static std::mutex g_mutex;
+    lock = std::unique_lock<std::mutex>(g_mutex);
 #ifdef __GLIBC__
     optind = 0;
 #else

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Thu May 19 00:13:57 2016
@@ -575,8 +575,8 @@ Args::ParseOptions (Options &options)
             }
         }
     }
-    Mutex::Locker options_locker(NULL);
-    OptionParser::Prepare(options_locker);
+    std::unique_lock<std::mutex> lock;
+    OptionParser::Prepare(lock);
     int val;
     while (1)
     {
@@ -1218,8 +1218,8 @@ Args::ParseAliasOptions (Options &option
         }
     }
 
-    Mutex::Locker options_locker(NULL);
-    OptionParser::Prepare(options_locker);
+    std::unique_lock<std::mutex> lock;
+    OptionParser::Prepare(lock);
     int val;
     while (1)
     {
@@ -1396,8 +1396,8 @@ Args::ParseArgsForCompletion
         }
     }
 
-    Mutex::Locker options_locker(NULL);
-    OptionParser::Prepare(options_locker);
+    std::unique_lock<std::mutex> lock;
+    OptionParser::Prepare(lock);
     OptionParser::EnableError(false);
 
     int val;

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Thu May 19 00:13:57 2016
@@ -276,7 +276,7 @@ CommandObject::CheckRequirements (Comman
         {
             Target *target = m_exe_ctx.GetTargetPtr();
             if (target)
-                m_api_locker.Lock (target->GetAPIMutex());
+                m_api_locker = std::unique_lock<std::recursive_mutex>(target->GetAPIMutex());
         }
     }
 
@@ -336,7 +336,8 @@ void
 CommandObject::Cleanup ()
 {
     m_exe_ctx.Clear();
-    m_api_locker.Unlock();
+    if (m_api_locker.owns_lock())
+        m_api_locker.unlock();
 }
 
 int

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Thu May 19 00:13:57 2016
@@ -1275,8 +1275,8 @@ DynamicLoaderMacOSXDYLD::InitializeFromA
         Target &target = m_process->GetTarget();
         const ModuleList &target_modules = target.GetImages();
         ModuleList not_loaded_modules;
-        Mutex::Locker modules_locker(target_modules.GetMutex());
-        
+        std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
+
         size_t num_modules = target_modules.GetSize();
         for (size_t i = 0; i < num_modules; i++)
         {

Modified: lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp Thu May 19 00:13:57 2016
@@ -102,8 +102,8 @@ DynamicLoaderStatic::LoadAllImagesAtFile
     // Disable JIT for static dynamic loader targets
     m_process->SetCanJIT(false);
 
-    Mutex::Locker mutex_locker(module_list.GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
+
     const size_t num_modules = module_list.GetSize();
     for (uint32_t idx = 0; idx < num_modules; ++idx)
     {

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Thu May 19 00:13:57 2016
@@ -708,7 +708,7 @@ ClangASTSource::FindExternalVisibleDecls
     else
     {
         const ModuleList &target_images = m_target->GetImages();
-        Mutex::Locker modules_locker (target_images.GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(target_images.GetMutex());
 
         for (size_t i = 0, e = target_images.GetSize(); i < e; ++i)
         {
@@ -1826,7 +1826,7 @@ ClangASTSource::CompleteNamespaceMap (Cl
     else
     {
         const ModuleList &target_images = m_target->GetImages();
-        Mutex::Locker modules_locker(target_images.GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(target_images.GetMutex());
 
         CompilerDeclContext null_namespace_decl;
 

Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp Thu May 19 00:13:57 2016
@@ -98,8 +98,8 @@ AddressSanitizerRuntime::ModulesDidLoad(
         Activate();
         return;
     }
-    
-    Mutex::Locker modules_locker(module_list.GetMutex());
+
+    std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
     const size_t num_modules = module_list.GetSize();
     for (size_t i = 0; i < num_modules; ++i)
     {

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Thu May 19 00:13:57 2016
@@ -394,8 +394,8 @@ AppleObjCRuntime::GetObjCVersion (Proces
         return ObjCRuntimeVersions::eObjC_VersionUnknown;
 
     const ModuleList &target_modules = target.GetImages();
-    Mutex::Locker modules_locker(target_modules.GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> gaurd(target_modules.GetMutex());
+
     size_t num_images = target_modules.GetSize();
     for (size_t i = 0; i < num_images; i++)
     {
@@ -524,7 +524,7 @@ AppleObjCRuntime::ReadObjCLibraryIfNeede
 {
     if (!HasReadObjCLibrary ())
     {
-        Mutex::Locker locker (module_list.GetMutex ());
+        std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
 
         size_t num_modules = module_list.GetSize();
         for (size_t i = 0; i < num_modules; i++)

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Thu May 19 00:13:57 2016
@@ -462,7 +462,7 @@ AppleObjCTrampolineHandler::AppleObjCVTa
         Target &target = process_sp->GetTarget();
         
         const ModuleList &target_modules = target.GetImages();
-        Mutex::Locker modules_locker(target_modules.GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
         size_t num_modules = target_modules.GetSize();
         if (!m_objc_module_sp)
         {

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu May 19 00:13:57 2016
@@ -871,7 +871,7 @@ RenderScriptRuntime::IsRenderScriptModul
 void
 RenderScriptRuntime::ModulesDidLoad(const ModuleList &module_list)
 {
-    Mutex::Locker locker(module_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
 
     size_t num_modules = module_list.GetSize();
     for (size_t i = 0; i < num_modules; i++)

Modified: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp (original)
+++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp Thu May 19 00:13:57 2016
@@ -38,7 +38,7 @@ MemoryHistoryASan::CreateInstance (const
     Target & target = process_sp->GetTarget();
 
     const ModuleList &target_modules = target.GetImages();
-    Mutex::Locker modules_locker(target_modules.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
     const size_t num_modules = target_modules.GetSize();
     for (size_t i = 0; i < num_modules; ++i)
     {

Modified: lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp Thu May 19 00:13:57 2016
@@ -162,7 +162,7 @@ ObjectFileJIT::GetSymtab()
         if (m_symtab_ap.get() == NULL)
         {
             m_symtab_ap.reset(new Symtab(this));
-            Mutex::Locker symtab_locker (m_symtab_ap->GetMutex());
+            std::lock_guard<std::recursive_mutex> symtab_guard(m_symtab_ap->GetMutex());
             ObjectFileJITDelegateSP delegate_sp (m_delegate_wp.lock());
             if (delegate_sp)
                 delegate_sp->PopulateSymtab(this, *m_symtab_ap);

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu May 19 00:13:57 2016
@@ -1461,7 +1461,7 @@ ObjectFileMachO::GetSymtab()
         if (m_symtab_ap.get() == NULL)
         {
             m_symtab_ap.reset(new Symtab(this));
-            Mutex::Locker symtab_locker (m_symtab_ap->GetMutex());
+            std::lock_guard<std::recursive_mutex> symtab_guard(m_symtab_ap->GetMutex());
             ParseSymtab ();
             m_symtab_ap->Finalize ();
         }

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Thu May 19 00:13:57 2016
@@ -539,8 +539,8 @@ ObjectFilePECOFF::GetSymtab()
         {
             SectionList *sect_list = GetSectionList();
             m_symtab_ap.reset(new Symtab(this));
-            Mutex::Locker symtab_locker (m_symtab_ap->GetMutex());
-            
+            std::lock_guard<std::recursive_mutex> guard(m_symtab_ap->GetMutex());
+
             const uint32_t num_syms = m_coff_header.nsyms;
 
             if (num_syms > 0 && m_coff_header.symoff > 0)

Modified: lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp Thu May 19 00:13:57 2016
@@ -197,7 +197,7 @@ OperatingSystemGo::CreateInstance(Proces
         if (!target_sp)
             return nullptr;
         ModuleList &module_list = target_sp->GetImages();
-        Mutex::Locker modules_locker(module_list.GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
         const size_t num_modules = module_list.GetSize();
         bool found_go_runtime = false;
         for (size_t i = 0; i < num_modules; ++i)

Modified: lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Thu May 19 00:13:57 2016
@@ -183,16 +183,16 @@ OperatingSystemPython::UpdateThreadList
     // This is a recursive lock so we can grant it to any Python code called on
     // the stack below us.
     Target &target = m_process->GetTarget();
-    Mutex::Locker api_locker;
-    api_locker.TryLock(target.GetAPIMutex());
-    
+    std::unique_lock<std::recursive_mutex> lock(target.GetAPIMutex(), std::defer_lock);
+    lock.try_lock();
+
     if (log)
         log->Printf ("OperatingSystemPython::UpdateThreadList() fetching thread data from python for pid %" PRIu64, m_process->GetID());
 
     // The threads that are in "new_thread_list" upon entry are the threads from the
     // lldb_private::Process subclass, no memory threads will be in this list.
-    
-    auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure threads_list stays alive
+
+    auto interpreter_lock = m_interpreter->AcquireInterpreterLock(); // to make sure threads_list stays alive
     StructuredData::ArraySP threads_list = m_interpreter->OSPlugin_ThreadsInfo(m_python_object_sp);
 
     const uint32_t num_cores = core_thread_list.GetSize(false);
@@ -324,7 +324,7 @@ OperatingSystemPython::CreateRegisterCon
     // content of the process, and we're going to use python, which requires the API lock to do it.
     // So get & hold that.  This is a recursive lock so we can grant it to any Python code called on the stack below us.
     Target &target = m_process->GetTarget();
-    Mutex::Locker api_locker (target.GetAPIMutex());
+    std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex());
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
 
@@ -399,8 +399,8 @@ OperatingSystemPython::CreateThread (lld
         // content of the process, and we're going to use python, which requires the API lock to do it.
         // So get & hold that.  This is a recursive lock so we can grant it to any Python code called on the stack below us.
         Target &target = m_process->GetTarget();
-        Mutex::Locker api_locker (target.GetAPIMutex());
-        
+        std::lock_guard<std::recursive_mutex> guard(target.GetAPIMutex());
+
         auto lock = m_interpreter->AcquireInterpreterLock(); // to make sure thread_info_dict stays alive
         StructuredData::DictionarySP thread_info_dict = m_interpreter->OSPlugin_CreateThread(m_python_object_sp, tid, context);
         std::vector<bool> core_used_map;

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu May 19 00:13:57 2016
@@ -143,7 +143,7 @@ ProcessFreeBSD::DoResume()
 
     SetPrivateState(eStateRunning);
 
-    Mutex::Locker lock(m_thread_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
     bool do_step = false;
 
     for (tid_collection::const_iterator t_pos = m_run_tids.begin(), t_end = m_run_tids.end(); t_pos != t_end; ++t_pos)
@@ -630,7 +630,7 @@ ProcessFreeBSD::RefreshStateAfterStop()
             if (log)
                 log->Printf ("ProcessFreeBSD::%s() removing thread, tid = %" PRIi64, __FUNCTION__, tid);
 
-            Mutex::Locker lock(m_thread_list.GetMutex());
+            std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
 
             ThreadSP thread_sp = m_thread_list.RemoveThreadByID(tid, false);
             thread_sp.reset();
@@ -801,7 +801,7 @@ ProcessFreeBSD::EnableWatchpoint(Watchpo
 
         // Try to find a vacant watchpoint slot in the inferiors' main thread
         uint32_t wp_hw_index = LLDB_INVALID_INDEX32;
-        Mutex::Locker lock(m_thread_list.GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
         FreeBSDThread *thread = static_cast<FreeBSDThread*>(
                                m_thread_list.GetThreadAtIndex(0, false).get());
 
@@ -871,7 +871,7 @@ ProcessFreeBSD::DisableWatchpoint(Watchp
         if (wp->IsHardware())
         {
             bool wp_disabled = true;
-            Mutex::Locker lock(m_thread_list.GetMutex());
+            std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
             uint32_t thread_count = m_thread_list.GetSize(false);
             for (uint32_t i = 0; i < thread_count; ++i)
             {
@@ -901,7 +901,7 @@ Error
 ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num)
 {
     Error error;
-    Mutex::Locker lock(m_thread_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
     FreeBSDThread *thread = static_cast<FreeBSDThread*>(
                           m_thread_list.GetThreadAtIndex(0, false).get());
     if (thread)
@@ -924,7 +924,7 @@ ProcessFreeBSD::GetWatchpointSupportInfo
 uint32_t
 ProcessFreeBSD::UpdateThreadListIfNeeded()
 {
-    Mutex::Locker lock(m_thread_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
     // Do not allow recursive updates.
     return m_thread_list.GetSize(false);
 }
@@ -1015,7 +1015,7 @@ bool
 ProcessFreeBSD::IsAThreadRunning()
 {
     bool is_running = false;
-    Mutex::Locker lock(m_thread_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
     uint32_t thread_count = m_thread_list.GetSize(false);
     for (uint32_t i = 0; i < thread_count; ++i)
     {

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Thu May 19 00:13:57 2016
@@ -37,21 +37,21 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // CommunicationKDP constructor
 //----------------------------------------------------------------------
-CommunicationKDP::CommunicationKDP (const char *comm_name) :
-    Communication(comm_name),
-    m_addr_byte_size (4),
-    m_byte_order (eByteOrderLittle),
-    m_packet_timeout (5),
-    m_sequence_mutex (Mutex::eMutexTypeRecursive),
-    m_is_running (false),
-    m_session_key (0u),
-    m_request_sequence_id (0u),
-    m_exception_sequence_id (0u),
-    m_kdp_version_version (0u),
-    m_kdp_version_feature (0u),
-    m_kdp_hostinfo_cpu_mask (0u),
-    m_kdp_hostinfo_cpu_type (0u),
-    m_kdp_hostinfo_cpu_subtype (0u)
+CommunicationKDP::CommunicationKDP(const char *comm_name)
+    : Communication(comm_name),
+      m_addr_byte_size(4),
+      m_byte_order(eByteOrderLittle),
+      m_packet_timeout(5),
+      m_sequence_mutex(),
+      m_is_running(false),
+      m_session_key(0u),
+      m_request_sequence_id(0u),
+      m_exception_sequence_id(0u),
+      m_kdp_version_version(0u),
+      m_kdp_version_feature(0u),
+      m_kdp_hostinfo_cpu_mask(0u),
+      m_kdp_hostinfo_cpu_type(0u),
+      m_kdp_hostinfo_cpu_subtype(0u)
 {
 }
 
@@ -69,7 +69,7 @@ CommunicationKDP::~CommunicationKDP()
 bool
 CommunicationKDP::SendRequestPacket (const PacketStreamType &request_packet)
 {
-    Mutex::Locker locker(m_sequence_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);
     return SendRequestPacketNoLock (request_packet);
 }
 
@@ -111,7 +111,7 @@ CommunicationKDP::SendRequestAndGetReply
         return false;
     }
 
-    Mutex::Locker locker(m_sequence_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);
 #ifdef LLDB_CONFIGURATION_DEBUG
     // NOTE: this only works for packets that are in native endian byte order
     assert (request_packet.GetSize() == *((uint16_t *)(request_packet.GetData() + 2)));
@@ -205,9 +205,9 @@ CommunicationKDP::SendRequestPacketNoLoc
 }
 
 bool
-CommunicationKDP::GetSequenceMutex (Mutex::Locker& locker)
+CommunicationKDP::GetSequenceMutex(std::unique_lock<std::recursive_mutex> &lock)
 {
-    return locker.TryLock (m_sequence_mutex);
+    return (lock = std::unique_lock<std::recursive_mutex>(m_sequence_mutex, std::try_to_lock)).owns_lock();
 }
 
 
@@ -220,7 +220,7 @@ CommunicationKDP::WaitForNotRunningPriva
 size_t
 CommunicationKDP::WaitForPacketWithTimeoutMicroSeconds (DataExtractor &packet, uint32_t timeout_usec)
 {
-    Mutex::Locker locker(m_sequence_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);
     return WaitForPacketWithTimeoutMicroSecondsNoLock (packet, timeout_usec);
 }
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h Thu May 19 00:13:57 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <list>
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
@@ -21,7 +22,6 @@
 #include "lldb/Core/Communication.h"
 #include "lldb/Core/Listener.h"
 #include "lldb/Core/StreamBuffer.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/TimeValue.h"
 
@@ -109,7 +109,7 @@ public:
                                           uint32_t usec);
 
     bool
-    GetSequenceMutex(lldb_private::Mutex::Locker& locker);
+    GetSequenceMutex(std::unique_lock<std::recursive_mutex> &lock);
 
     bool
     CheckForPacket (const uint8_t *src, 
@@ -324,7 +324,7 @@ protected:
     uint32_t m_addr_byte_size;
     lldb::ByteOrder m_byte_order;
     uint32_t m_packet_timeout;
-    lldb_private::Mutex m_sequence_mutex;    // Restrict access to sending/receiving packets to a single thread at a time
+    std::recursive_mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time
     lldb_private::Predicate<bool> m_is_running;
     uint32_t m_session_key;
     uint8_t m_request_sequence_id;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu May 19 00:13:57 2016
@@ -1646,7 +1646,7 @@ ProcessGDBRemote::HandleStopReplySequenc
 void
 ProcessGDBRemote::ClearThreadIDList ()
 {
-    Mutex::Locker locker(m_thread_list_real.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list_real.GetMutex());
     m_thread_ids.clear();
     m_thread_pcs.clear();
 }
@@ -1696,7 +1696,7 @@ ProcessGDBRemote::UpdateThreadPCsFromSto
 bool
 ProcessGDBRemote::UpdateThreadIDList ()
 {
-    Mutex::Locker locker(m_thread_list_real.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list_real.GetMutex());
 
     if (m_jthreadsinfo_sp)
     {
@@ -1944,7 +1944,7 @@ ProcessGDBRemote::SetThreadStopInfo (lld
             // m_thread_list_real does have its own mutex, but we need to
             // hold onto the mutex between the call to m_thread_list_real.FindThreadByID(...)
             // and the m_thread_list_real.AddThread(...) so it doesn't change on us
-            Mutex::Locker locker (m_thread_list_real.GetMutex ());
+            std::lock_guard<std::recursive_mutex> guard(m_thread_list_real.GetMutex());
             thread_sp = m_thread_list_real.FindThreadByProtocolID(tid, false);
 
             if (!thread_sp)
@@ -2440,7 +2440,8 @@ ProcessGDBRemote::SetThreadStopInfo (Str
                 }
                 else if (key.compare("threads") == 0)
                 {
-                    Mutex::Locker locker(m_thread_list_real.GetMutex());
+                    std::lock_guard<std::recursive_mutex> guard(m_thread_list_real.GetMutex());
+
                     m_thread_ids.clear();
                     // A comma separated list of all threads in the current
                     // process that includes the thread for this stop reply
@@ -2663,7 +2664,8 @@ ProcessGDBRemote::SetThreadStopInfo (Str
 void
 ProcessGDBRemote::RefreshStateAfterStop ()
 {
-    Mutex::Locker locker(m_thread_list_real.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_thread_list_real.GetMutex());
+
     m_thread_ids.clear();
     m_thread_pcs.clear();
     // Set the thread stop info. It might have a "threads" key whose value is
@@ -2818,7 +2820,7 @@ ProcessGDBRemote::DoDestroy ()
                 ThreadList &threads = GetThreadList();
 
                 {
-                    Mutex::Locker locker(threads.GetMutex());
+                    std::lock_guard<std::recursive_mutex> guard(threads.GetMutex());
 
                     size_t num_threads = threads.GetSize();
                     for (size_t i = 0; i < num_threads; i++)
@@ -2853,7 +2855,7 @@ ProcessGDBRemote::DoDestroy ()
                     // have to run the risk of letting those threads proceed a bit.
 
                     {
-                        Mutex::Locker locker(threads.GetMutex());
+                        std::lock_guard<std::recursive_mutex> guard(threads.GetMutex());
 
                         size_t num_threads = threads.GetSize();
                         for (size_t i = 0; i < num_threads; i++)

Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp (original)
+++ lldb/trunk/source/Symbol/ClangExternalASTSourceCommon.cpp Thu May 19 00:13:57 2016
@@ -9,7 +9,6 @@
 
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
 #include "lldb/Core/Stream.h"
-#include "lldb/Host/Mutex.h"
 
 using namespace lldb_private;
 

Modified: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompactUnwindInfo.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp (original)
+++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp Thu May 19 00:13:57 2016
@@ -130,19 +130,17 @@ namespace lldb_private {
 // constructor 
 //----------------------
 
-
-CompactUnwindInfo::CompactUnwindInfo(ObjectFile& objfile, SectionSP& section_sp) :
-    m_objfile (objfile),
-    m_section_sp (section_sp),
-    m_section_contents_if_encrypted (),
-    m_mutex (),
-    m_indexes (),
-    m_indexes_computed (eLazyBoolCalculate),
-    m_unwindinfo_data (),
-    m_unwindinfo_data_computed (false),
-    m_unwind_header ()
+CompactUnwindInfo::CompactUnwindInfo(ObjectFile &objfile, SectionSP &section_sp)
+    : m_objfile(objfile),
+      m_section_sp(section_sp),
+      m_section_contents_if_encrypted(),
+      m_mutex(),
+      m_indexes(),
+      m_indexes_computed(eLazyBoolCalculate),
+      m_unwindinfo_data(),
+      m_unwindinfo_data_computed(false),
+      m_unwind_header()
 {
-
 }
 
 //----------------------
@@ -223,7 +221,7 @@ CompactUnwindInfo::IsValid (const Proces
 void
 CompactUnwindInfo::ScanIndex (const ProcessSP &process_sp)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (m_indexes_computed == eLazyBoolYes && m_unwindinfo_data_computed)
         return;
 

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Thu May 19 00:13:57 2016
@@ -308,9 +308,9 @@ DWARFCallFrameInfo::GetFDEIndex ()
     
     if (m_fde_index_initialized)
         return;
-    
-    Mutex::Locker locker(m_fde_index_mutex);
-    
+
+    std::lock_guard<std::mutex> guard(m_fde_index_mutex);
+
     if (m_fde_index_initialized) // if two threads hit the locker
         return;
 

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Thu May 19 00:13:57 2016
@@ -25,16 +25,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-
-
-Symtab::Symtab(ObjectFile *objfile) :
-    m_objfile (objfile),
-    m_symbols (),
-    m_file_addr_to_index (),
-    m_name_to_index (),
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_file_addr_to_index_computed (false),
-    m_name_indexes_computed (false)
+Symtab::Symtab(ObjectFile *objfile)
+    : m_objfile(objfile),
+      m_symbols(),
+      m_file_addr_to_index(),
+      m_name_to_index(),
+      m_mutex(),
+      m_file_addr_to_index_computed(false),
+      m_name_indexes_computed(false)
 {
 }
 
@@ -76,7 +74,7 @@ Symtab::AddSymbol(const Symbol& symbol)
 size_t
 Symtab::GetNumSymbols() const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_symbols.size();
 }
 
@@ -90,9 +88,9 @@ Symtab::SectionFileAddressesChanged ()
 void
 Symtab::Dump (Stream *s, Target *target, SortOrder sort_order)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
-//    s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
+    //    s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
     s->Indent();
     const FileSpec &file_spec = m_objfile->GetFileSpec();
     const char * object_name = nullptr;
@@ -171,7 +169,7 @@ Symtab::Dump (Stream *s, Target *target,
 void
 Symtab::Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     const size_t num_symbols = GetNumSymbols();
     //s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
@@ -224,7 +222,7 @@ CompareSymbolID (const void *key, const
 Symbol *
 Symtab::FindSymbolByID (lldb::user_id_t symbol_uid) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Symbol *symbol = (Symbol*)::bsearch (&symbol_uid, 
                                          &m_symbols[0], 
@@ -474,7 +472,7 @@ Symtab::AppendSymbolNamesToMap (const In
     if (add_demangled || add_mangled)
     {
         Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
         // Create the name index vector to be able to quickly search by name
         NameToIndexMap::Entry entry;
@@ -506,7 +504,7 @@ Symtab::AppendSymbolNamesToMap (const In
 uint32_t
 Symtab::AppendSymbolIndexesWithType (SymbolType symbol_type, std::vector<uint32_t>& indexes, uint32_t start_idx, uint32_t end_index) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     uint32_t prev_size = indexes.size();
 
@@ -524,7 +522,7 @@ Symtab::AppendSymbolIndexesWithType (Sym
 uint32_t
 Symtab::AppendSymbolIndexesWithTypeAndFlagsValue (SymbolType symbol_type, uint32_t flags_value, std::vector<uint32_t>& indexes, uint32_t start_idx, uint32_t end_index) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     uint32_t prev_size = indexes.size();
 
@@ -542,7 +540,7 @@ Symtab::AppendSymbolIndexesWithTypeAndFl
 uint32_t
 Symtab::AppendSymbolIndexesWithType (SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes, uint32_t start_idx, uint32_t end_index) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     uint32_t prev_size = indexes.size();
 
@@ -632,7 +630,7 @@ namespace {
 void
 Symtab::SortSymbolIndexesByValue (std::vector<uint32_t>& indexes, bool remove_duplicates) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__);
     // No need to sort if we have zero or one items...
@@ -657,7 +655,7 @@ Symtab::SortSymbolIndexesByValue (std::v
 uint32_t
 Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, std::vector<uint32_t>& indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
     if (symbol_name)
@@ -674,7 +672,7 @@ Symtab::AppendSymbolIndexesWithName (con
 uint32_t
 Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
     if (symbol_name)
@@ -700,7 +698,7 @@ Symtab::AppendSymbolIndexesWithName (con
 uint32_t
 Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, SymbolType symbol_type, std::vector<uint32_t>& indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (AppendSymbolIndexesWithName(symbol_name, indexes) > 0)
     {
@@ -719,7 +717,7 @@ Symtab::AppendSymbolIndexesWithNameAndTy
 uint32_t
 Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (AppendSymbolIndexesWithName(symbol_name, symbol_debug_type, symbol_visibility, indexes) > 0)
     {
@@ -739,7 +737,7 @@ Symtab::AppendSymbolIndexesWithNameAndTy
 uint32_t
 Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression &regexp, SymbolType symbol_type, std::vector<uint32_t>& indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     uint32_t prev_size = indexes.size();
     uint32_t sym_end = m_symbols.size();
@@ -763,7 +761,7 @@ Symtab::AppendSymbolIndexesMatchingRegEx
 uint32_t
 Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression &regexp, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     uint32_t prev_size = indexes.size();
     uint32_t sym_end = m_symbols.size();
@@ -790,7 +788,7 @@ Symtab::AppendSymbolIndexesMatchingRegEx
 Symbol *
 Symtab::FindSymbolWithType (SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t& start_idx)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     const size_t count = m_symbols.size();
     for (size_t idx = start_idx; idx < count; ++idx)
@@ -810,7 +808,7 @@ Symtab::FindSymbolWithType (SymbolType s
 size_t
 Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, std::vector<uint32_t>& symbol_indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
     // Initialize all of the lookup by name indexes before converting NAME
@@ -830,7 +828,7 @@ Symtab::FindAllSymbolsWithNameAndType (c
 size_t
 Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& symbol_indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
     // Initialize all of the lookup by name indexes before converting NAME
@@ -850,7 +848,7 @@ Symtab::FindAllSymbolsWithNameAndType (c
 size_t
 Symtab::FindAllSymbolsMatchingRexExAndType (const RegularExpression &regex, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& symbol_indexes)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     AppendSymbolIndexesMatchingRegExAndType(regex, symbol_type, symbol_debug_type, symbol_visibility, symbol_indexes);
     return symbol_indexes.size();
@@ -859,7 +857,7 @@ Symtab::FindAllSymbolsMatchingRexExAndTy
 Symbol *
 Symtab::FindFirstSymbolWithNameAndType (const ConstString &name, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__);
     if (!m_name_indexes_computed)
@@ -1026,7 +1024,7 @@ Symtab::InitAddressIndexes()
 void
 Symtab::CalculateSymbolSizes ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (!m_symbols.empty())
     {
@@ -1060,7 +1058,7 @@ Symtab::CalculateSymbolSizes ()
 Symbol *
 Symtab::FindSymbolAtFileAddress (addr_t file_addr)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_file_addr_to_index_computed)
         InitAddressIndexes();
 
@@ -1077,7 +1075,7 @@ Symtab::FindSymbolAtFileAddress (addr_t
 Symbol *
 Symtab::FindSymbolContainingFileAddress (addr_t file_addr)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (!m_file_addr_to_index_computed)
         InitAddressIndexes();
@@ -1095,7 +1093,7 @@ Symtab::FindSymbolContainingFileAddress
 void
 Symtab::ForEachSymbolContainingFileAddress(addr_t file_addr, std::function<bool(Symbol *)> const &callback)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (!m_file_addr_to_index_computed)
         InitAddressIndexes();
@@ -1159,7 +1157,7 @@ Symtab::FindFunctionSymbols (const Const
         unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
         if (temp_symbol_indexes_size > 0)
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             for (unsigned i = 0; i < temp_symbol_indexes_size; i++)
             {
                 SymbolContext sym_ctx;

Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Thu May 19 00:13:57 2016
@@ -163,10 +163,7 @@ TypeSystem::DeclContextFindDeclByName (v
 
 #pragma mark TypeSystemMap
 
-TypeSystemMap::TypeSystemMap() :
-    m_mutex (),
-    m_map (),
-    m_clear_in_progress(false)
+TypeSystemMap::TypeSystemMap() : m_mutex(), m_map(), m_clear_in_progress(false)
 {
 }
 
@@ -179,7 +176,7 @@ TypeSystemMap::Clear ()
 {
     collection map;
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::mutex> guard(m_mutex);
         map = m_map;
         m_clear_in_progress = true;
     }
@@ -195,7 +192,7 @@ TypeSystemMap::Clear ()
     }
     map.clear();
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::mutex> guard(m_mutex);
         m_map.clear();
         m_clear_in_progress = false;
     }
@@ -205,7 +202,7 @@ TypeSystemMap::Clear ()
 void
 TypeSystemMap::ForEach (std::function <bool(TypeSystem *)> const &callback)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     // Use a std::set so we only call the callback once for each unique
     // TypeSystem instance
     std::set<TypeSystem *> visited;
@@ -224,7 +221,7 @@ TypeSystemMap::ForEach (std::function <b
 TypeSystem *
 TypeSystemMap::GetTypeSystemForLanguage (lldb::LanguageType language, Module *module, bool can_create)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     collection::iterator pos = m_map.find(language);
     if (pos != m_map.end())
         return pos->second.get();
@@ -252,7 +249,7 @@ TypeSystemMap::GetTypeSystemForLanguage
 TypeSystem *
 TypeSystemMap::GetTypeSystemForLanguage (lldb::LanguageType language, Target *target, bool can_create)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     collection::iterator pos = m_map.find(language);
     if (pos != m_map.end())
         return pos->second.get();

Modified: lldb/trunk/source/Symbol/UnwindTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindTable.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindTable.cpp Thu May 19 00:13:57 2016
@@ -27,14 +27,14 @@
 using namespace lldb;
 using namespace lldb_private;
 
-UnwindTable::UnwindTable (ObjectFile& objfile) : 
-    m_object_file (objfile), 
-    m_unwinds (),
-    m_initialized (false),
-    m_mutex (),
-    m_eh_frame_up (),
-    m_compact_unwind_up (),
-    m_arm_unwind_up ()
+UnwindTable::UnwindTable(ObjectFile &objfile)
+    : m_object_file(objfile),
+      m_unwinds(),
+      m_initialized(false),
+      m_mutex(),
+      m_eh_frame_up(),
+      m_compact_unwind_up(),
+      m_arm_unwind_up()
 {
 }
 
@@ -47,7 +47,7 @@ UnwindTable::Initialize ()
     if (m_initialized)
         return;
 
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
 
     if (m_initialized) // check again once we've acquired the lock
         return;
@@ -90,7 +90,7 @@ UnwindTable::GetFuncUnwindersContainingA
 
     Initialize();
 
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
 
     // There is an UnwindTable per object file, so we can safely use file handles
     addr_t file_addr = addr.GetFileAddress();
@@ -152,7 +152,7 @@ UnwindTable::GetUncachedFuncUnwindersCon
 void
 UnwindTable::Dump (Stream &s)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     s.Printf("UnwindTable for '%s':\n", m_object_file.GetFileSpec().GetPath().c_str());
     const_iterator begin = m_unwinds.begin();
     const_iterator end = m_unwinds.end();

Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Thu May 19 00:13:57 2016
@@ -186,18 +186,17 @@ ExecutionContext::ExecutionContext (cons
     }
 }
 
-ExecutionContext::ExecutionContext (const ExecutionContextRef *exe_ctx_ref_ptr, Mutex::Locker &locker) :
-    m_target_sp (),
-    m_process_sp (),
-    m_thread_sp (),
-    m_frame_sp ()
+ExecutionContext::ExecutionContext(const ExecutionContextRef *exe_ctx_ref_ptr,
+                                   std::unique_lock<std::recursive_mutex> &lock)
+    : m_target_sp(), m_process_sp(), m_thread_sp(), m_frame_sp()
 {
     if (exe_ctx_ref_ptr)
     {
-        m_target_sp  = exe_ctx_ref_ptr->GetTargetSP();
+        m_target_sp = exe_ctx_ref_ptr->GetTargetSP();
         if (m_target_sp)
         {
-            locker.Lock(m_target_sp->GetAPIMutex());
+            lock = std::unique_lock<std::recursive_mutex>(m_target_sp->GetAPIMutex());
+
             m_process_sp = exe_ctx_ref_ptr->GetProcessSP();
             m_thread_sp = exe_ctx_ref_ptr->GetThreadSP();
             m_frame_sp = exe_ctx_ref_ptr->GetFrameSP();
@@ -205,18 +204,16 @@ ExecutionContext::ExecutionContext (cons
     }
 }
 
-ExecutionContext::ExecutionContext (const ExecutionContextRef &exe_ctx_ref, Mutex::Locker &locker) :
-    m_target_sp (exe_ctx_ref.GetTargetSP()),
-    m_process_sp (),
-    m_thread_sp (),
-    m_frame_sp ()
+ExecutionContext::ExecutionContext(const ExecutionContextRef &exe_ctx_ref, std::unique_lock<std::recursive_mutex> &lock)
+    : m_target_sp(exe_ctx_ref.GetTargetSP()), m_process_sp(), m_thread_sp(), m_frame_sp()
 {
     if (m_target_sp)
     {
-        locker.Lock(m_target_sp->GetAPIMutex());
+        lock = std::unique_lock<std::recursive_mutex>(m_target_sp->GetAPIMutex());
+
         m_process_sp = exe_ctx_ref.GetProcessSP();
-        m_thread_sp  = exe_ctx_ref.GetThreadSP();
-        m_frame_sp   = exe_ctx_ref.GetFrameSP();
+        m_thread_sp = exe_ctx_ref.GetThreadSP();
+        m_frame_sp = exe_ctx_ref.GetFrameSP();
     }
 }
 

Modified: lldb/trunk/source/Target/Language.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Thu May 19 00:13:57 2016
@@ -13,7 +13,6 @@
 
 #include "lldb/Target/Language.h"
 
-#include "lldb/Host/Mutex.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Stream.h"
 

Modified: lldb/trunk/source/Target/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Memory.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/Memory.cpp (original)
+++ lldb/trunk/source/Target/Memory.cpp Thu May 19 00:13:57 2016
@@ -25,13 +25,13 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // MemoryCache constructor
 //----------------------------------------------------------------------
-MemoryCache::MemoryCache(Process &process) :
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_L1_cache (),
-    m_L2_cache (),
-    m_invalid_ranges (),
-    m_process (process),
-    m_L2_cache_line_byte_size (process.GetMemoryCacheLineSize())
+MemoryCache::MemoryCache(Process &process)
+    : m_mutex(),
+      m_L1_cache(),
+      m_L2_cache(),
+      m_invalid_ranges(),
+      m_process(process),
+      m_L2_cache_line_byte_size(process.GetMemoryCacheLineSize())
 {
 }
 
@@ -45,7 +45,7 @@ MemoryCache::~MemoryCache()
 void
 MemoryCache::Clear(bool clear_invalid_ranges)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_L1_cache.clear();
     m_L2_cache.clear();
     if (clear_invalid_ranges)
@@ -62,7 +62,7 @@ MemoryCache::AddL1CacheData(lldb::addr_t
 void
 MemoryCache::AddL1CacheData(lldb::addr_t addr, const DataBufferSP &data_buffer_sp)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_L1_cache[addr] = data_buffer_sp;
 }
 
@@ -72,7 +72,7 @@ MemoryCache::Flush (addr_t addr, size_t
     if (size == 0)
         return;
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // Erase any blocks from the L1 cache that intersect with the flush range
     if (!m_L1_cache.empty())
@@ -123,7 +123,7 @@ MemoryCache::AddInvalidRange (lldb::addr
 {
     if (byte_size > 0)
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         InvalidRanges::Entry range (base_addr, byte_size);
         m_invalid_ranges.Append(range);
         m_invalid_ranges.Sort();
@@ -135,7 +135,7 @@ MemoryCache::RemoveInvalidRange (lldb::a
 {
     if (byte_size > 0)
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         const uint32_t idx = m_invalid_ranges.FindEntryIndexThatContains(base_addr);
         if (idx != UINT32_MAX)
         {
@@ -164,7 +164,7 @@ MemoryCache::Read (addr_t addr,
     // m_L2_cache_line_byte_size bytes in size, so we don't try anything
     // tricky when reading from them (no partial reads from the L1 cache).
 
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_L1_cache.empty())
     {
         AddrRange read_range(addr, dst_len);
@@ -436,11 +436,7 @@ AllocatedBlock::FreeBlock (addr_t addr)
     return success;
 }
 
-
-AllocatedMemoryCache::AllocatedMemoryCache (Process &process) :
-    m_process (process),
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_memory_map()
+AllocatedMemoryCache::AllocatedMemoryCache(Process &process) : m_process(process), m_mutex(), m_memory_map()
 {
 }
 
@@ -452,7 +448,7 @@ AllocatedMemoryCache::~AllocatedMemoryCa
 void
 AllocatedMemoryCache::Clear()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_process.IsAlive())
     {
         PermissionsToBlockMap::iterator pos, end = m_memory_map.end();
@@ -498,8 +494,8 @@ AllocatedMemoryCache::AllocateMemory (si
                                       uint32_t permissions, 
                                       Error &error)
 {
-    Mutex::Locker locker (m_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
+
     addr_t addr = LLDB_INVALID_ADDRESS;
     std::pair<PermissionsToBlockMap::iterator, PermissionsToBlockMap::iterator> range = m_memory_map.equal_range (permissions);
 
@@ -526,7 +522,7 @@ AllocatedMemoryCache::AllocateMemory (si
 bool
 AllocatedMemoryCache::DeallocateMemory (lldb::addr_t addr)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     PermissionsToBlockMap::iterator pos, end = m_memory_map.end();
     bool success = false;

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu May 19 00:13:57 2016
@@ -716,105 +716,99 @@ Process::Process(lldb::TargetSP target_s
     // defaulting to using the Host's UnixSignals.
 }
 
-Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp, const UnixSignalsSP &unix_signals_sp) :
-    ProcessProperties (this),
-    UserID (LLDB_INVALID_PROCESS_ID),
-    Broadcaster ((target_sp->GetDebugger().GetBroadcasterManager()), Process::GetStaticBroadcasterClass().AsCString()),
-    m_target_sp (target_sp),
-    m_public_state (eStateUnloaded),
-    m_private_state (eStateUnloaded),
-    m_private_state_broadcaster(nullptr, "lldb.process.internal_state_broadcaster"),
-    m_private_state_control_broadcaster(nullptr, "lldb.process.internal_state_control_broadcaster"),
-    m_private_state_listener_sp (Listener::MakeListener("lldb.process.internal_state_listener")),
-    m_mod_id (),
-    m_process_unique_id(0),
-    m_thread_index_id (0),
-    m_thread_id_to_index_id_map (),
-    m_exit_status (-1),
-    m_exit_string (),
-    m_exit_status_mutex(),
-    m_thread_mutex (Mutex::eMutexTypeRecursive),
-    m_thread_list_real (this),
-    m_thread_list (this),
-    m_extended_thread_list (this),
-    m_extended_thread_stop_id (0),
-    m_queue_list (this),
-    m_queue_list_stop_id (0),
-    m_notifications (),
-    m_image_tokens (),
-    m_listener_sp (listener_sp),
-    m_breakpoint_site_list (),
-    m_dynamic_checkers_ap (),
-    m_unix_signals_sp (unix_signals_sp),
-    m_abi_sp (),
-    m_process_input_reader (),
-    m_stdio_communication ("process.stdio"),
-    m_stdio_communication_mutex (Mutex::eMutexTypeRecursive),
-    m_stdin_forward (false),
-    m_stdout_data (),
-    m_stderr_data (),
-    m_profile_data_comm_mutex (Mutex::eMutexTypeRecursive),
-    m_profile_data (),
-    m_iohandler_sync (0),
-    m_memory_cache (*this),
-    m_allocated_memory_cache (*this),
-    m_should_detach (false),
-    m_next_event_action_ap(),
-    m_public_run_lock (),
-    m_private_run_lock (),
-    m_stop_info_override_callback(nullptr),
-    m_finalizing (false),
-    m_finalize_called (false),
-    m_clear_thread_plans_on_stop (false),
-    m_force_next_event_delivery (false),
-    m_last_broadcast_state (eStateInvalid),
-    m_destroy_in_process (false),
-    m_can_interpret_function_calls(false),
-    m_warnings_issued (),
-    m_can_jit(eCanJITDontKnow)
+Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp, const UnixSignalsSP &unix_signals_sp)
+    : ProcessProperties(this),
+      UserID(LLDB_INVALID_PROCESS_ID),
+      Broadcaster((target_sp->GetDebugger().GetBroadcasterManager()), Process::GetStaticBroadcasterClass().AsCString()),
+      m_target_sp(target_sp),
+      m_public_state(eStateUnloaded),
+      m_private_state(eStateUnloaded),
+      m_private_state_broadcaster(nullptr, "lldb.process.internal_state_broadcaster"),
+      m_private_state_control_broadcaster(nullptr, "lldb.process.internal_state_control_broadcaster"),
+      m_private_state_listener_sp(Listener::MakeListener("lldb.process.internal_state_listener")),
+      m_mod_id(),
+      m_process_unique_id(0),
+      m_thread_index_id(0),
+      m_thread_id_to_index_id_map(),
+      m_exit_status(-1),
+      m_exit_string(),
+      m_exit_status_mutex(),
+      m_thread_mutex(),
+      m_thread_list_real(this),
+      m_thread_list(this),
+      m_extended_thread_list(this),
+      m_extended_thread_stop_id(0),
+      m_queue_list(this),
+      m_queue_list_stop_id(0),
+      m_notifications(),
+      m_image_tokens(),
+      m_listener_sp(listener_sp),
+      m_breakpoint_site_list(),
+      m_dynamic_checkers_ap(),
+      m_unix_signals_sp(unix_signals_sp),
+      m_abi_sp(),
+      m_process_input_reader(),
+      m_stdio_communication("process.stdio"),
+      m_stdio_communication_mutex(),
+      m_stdin_forward(false),
+      m_stdout_data(),
+      m_stderr_data(),
+      m_profile_data_comm_mutex(),
+      m_profile_data(),
+      m_iohandler_sync(0),
+      m_memory_cache(*this),
+      m_allocated_memory_cache(*this),
+      m_should_detach(false),
+      m_next_event_action_ap(),
+      m_public_run_lock(),
+      m_private_run_lock(),
+      m_stop_info_override_callback(nullptr),
+      m_finalizing(false),
+      m_finalize_called(false),
+      m_clear_thread_plans_on_stop(false),
+      m_force_next_event_delivery(false),
+      m_last_broadcast_state(eStateInvalid),
+      m_destroy_in_process(false),
+      m_can_interpret_function_calls(false),
+      m_warnings_issued(),
+      m_can_jit(eCanJITDontKnow)
 {
-    CheckInWithManager ();
+    CheckInWithManager();
 
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
     if (log)
-        log->Printf ("%p Process::Process()", static_cast<void*>(this));
+        log->Printf("%p Process::Process()", static_cast<void *>(this));
 
     if (!m_unix_signals_sp)
         m_unix_signals_sp = std::make_shared<UnixSignals>();
 
-    SetEventName (eBroadcastBitStateChanged, "state-changed");
-    SetEventName (eBroadcastBitInterrupt, "interrupt");
-    SetEventName (eBroadcastBitSTDOUT, "stdout-available");
-    SetEventName (eBroadcastBitSTDERR, "stderr-available");
-    SetEventName (eBroadcastBitProfileData, "profile-data-available");
-
-    m_private_state_control_broadcaster.SetEventName (eBroadcastInternalStateControlStop  , "control-stop"  );
-    m_private_state_control_broadcaster.SetEventName (eBroadcastInternalStateControlPause , "control-pause" );
-    m_private_state_control_broadcaster.SetEventName (eBroadcastInternalStateControlResume, "control-resume");
-
-    m_listener_sp->StartListeningForEvents (this,
-                                      eBroadcastBitStateChanged |
-                                      eBroadcastBitInterrupt |
-                                      eBroadcastBitSTDOUT |
-                                      eBroadcastBitSTDERR |
-                                      eBroadcastBitProfileData);
+    SetEventName(eBroadcastBitStateChanged, "state-changed");
+    SetEventName(eBroadcastBitInterrupt, "interrupt");
+    SetEventName(eBroadcastBitSTDOUT, "stdout-available");
+    SetEventName(eBroadcastBitSTDERR, "stderr-available");
+    SetEventName(eBroadcastBitProfileData, "profile-data-available");
+
+    m_private_state_control_broadcaster.SetEventName(eBroadcastInternalStateControlStop, "control-stop");
+    m_private_state_control_broadcaster.SetEventName(eBroadcastInternalStateControlPause, "control-pause");
+    m_private_state_control_broadcaster.SetEventName(eBroadcastInternalStateControlResume, "control-resume");
+
+    m_listener_sp->StartListeningForEvents(this, eBroadcastBitStateChanged | eBroadcastBitInterrupt |
+                                                     eBroadcastBitSTDOUT | eBroadcastBitSTDERR |
+                                                     eBroadcastBitProfileData);
 
     m_private_state_listener_sp->StartListeningForEvents(&m_private_state_broadcaster,
-                                                     eBroadcastBitStateChanged |
-                                                     eBroadcastBitInterrupt);
+                                                         eBroadcastBitStateChanged | eBroadcastBitInterrupt);
 
-    m_private_state_listener_sp->StartListeningForEvents(&m_private_state_control_broadcaster,
-                                                     eBroadcastInternalStateControlStop |
-                                                     eBroadcastInternalStateControlPause |
-                                                     eBroadcastInternalStateControlResume);
+    m_private_state_listener_sp->StartListeningForEvents(
+        &m_private_state_control_broadcaster, eBroadcastInternalStateControlStop | eBroadcastInternalStateControlPause |
+                                                  eBroadcastInternalStateControlResume);
     // We need something valid here, even if just the default UnixSignalsSP.
-    assert (m_unix_signals_sp && "null m_unix_signals_sp after initialization");
+    assert(m_unix_signals_sp && "null m_unix_signals_sp after initialization");
 
     // Allow the platform to override the default cache line size
-    OptionValueSP value_sp =
-        m_collection_sp->GetPropertyAtIndex(nullptr, true, ePropertyMemCacheLineSize)->GetValue();
+    OptionValueSP value_sp = m_collection_sp->GetPropertyAtIndex(nullptr, true, ePropertyMemCacheLineSize)->GetValue();
     uint32_t platform_cache_line_size = target_sp->GetPlatform()->GetDefaultMemoryCacheLineSize();
-    if (! value_sp->OptionWasSet() && platform_cache_line_size != 0)
+    if (!value_sp->OptionWasSet() && platform_cache_line_size != 0)
         value_sp->SetUInt64Value(platform_cache_line_size);
 }
 
@@ -1153,7 +1147,7 @@ Process::HandleProcessStateChangedEvent
                 // Lock the thread list so it doesn't change on us, this is the scope for the locker:
                 {
                     ThreadList &thread_list = process_sp->GetThreadList();
-                    Mutex::Locker locker (thread_list.GetMutex());
+                    std::lock_guard<std::recursive_mutex> guard(thread_list.GetMutex());
 
                     ThreadSP curr_thread (thread_list.GetSelectedThread());
                     ThreadSP thread;
@@ -1422,7 +1416,7 @@ Process::IsRunning () const
 int
 Process::GetExitStatus ()
 {
-    Mutex::Locker locker (m_exit_status_mutex);
+    std::lock_guard<std::mutex> guard(m_exit_status_mutex);
 
     if (m_public_state.GetValue() == eStateExited)
         return m_exit_status;
@@ -1432,7 +1426,7 @@ Process::GetExitStatus ()
 const char *
 Process::GetExitDescription ()
 {
-    Mutex::Locker locker (m_exit_status_mutex);
+    std::lock_guard<std::mutex> guard(m_exit_status_mutex);
 
     if (m_public_state.GetValue() == eStateExited && !m_exit_string.empty())
         return m_exit_string.c_str();
@@ -1443,7 +1437,7 @@ bool
 Process::SetExitStatus (int status, const char *cstr)
 {
     // Use a mutex to protect setting the exit status.
-    Mutex::Locker locker (m_exit_status_mutex);
+    std::lock_guard<std::mutex> guard(m_exit_status_mutex);
 
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE | LIBLLDB_LOG_PROCESS));
     if (log)
@@ -1550,7 +1544,7 @@ Process::UpdateThreadListIfNeeded ()
         const StateType state = GetPrivateState();
         if (StateIsStoppedState (state, true))
         {
-            Mutex::Locker locker (m_thread_list.GetMutex ());
+            std::lock_guard<std::recursive_mutex> guard(m_thread_list.GetMutex());
             // m_thread_list does have its own mutex, but we need to
             // hold onto the mutex between the call to UpdateThreadList(...)
             // and the os->UpdateThreadList(...) so it doesn't change on us
@@ -1794,7 +1788,7 @@ Process::SetPrivateState (StateType new_
     if (log)
         log->Printf("Process::SetPrivateState (%s)", StateAsCString(new_state));
 
-    Mutex::Locker thread_locker(m_thread_list.GetMutex());
+    std::lock_guard<std::recursive_mutex> thread_guard(m_thread_list.GetMutex());
     std::lock_guard<std::recursive_mutex> guard(m_private_state.GetMutex());
 
     const StateType old_state = m_private_state.GetValueNoLock ();
@@ -3461,7 +3455,7 @@ Process::CompleteAttach ()
     m_os_ap.reset(OperatingSystem::FindPlugin(this, nullptr));
     // Figure out which one is the executable, and set that in our target:
     const ModuleList &target_modules = GetTarget().GetImages();
-    Mutex::Locker modules_locker(target_modules.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
     size_t num_modules = target_modules.GetSize();
     ModuleSP new_executable_module_sp;
     
@@ -4783,7 +4777,7 @@ Process::CalculateExecutionContext (Exec
 void
 Process::AppendSTDOUT (const char * s, size_t len)
 {
-    Mutex::Locker locker (m_stdio_communication_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex);
     m_stdout_data.append (s, len);
     BroadcastEventIfUnique (eBroadcastBitSTDOUT, new ProcessEventData (shared_from_this(), GetState()));
 }
@@ -4791,7 +4785,7 @@ Process::AppendSTDOUT (const char * s, s
 void
 Process::AppendSTDERR (const char * s, size_t len)
 {
-    Mutex::Locker locker (m_stdio_communication_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex);
     m_stderr_data.append (s, len);
     BroadcastEventIfUnique (eBroadcastBitSTDERR, new ProcessEventData (shared_from_this(), GetState()));
 }
@@ -4799,7 +4793,7 @@ Process::AppendSTDERR (const char * s, s
 void
 Process::BroadcastAsyncProfileData(const std::string &one_profile_data)
 {
-    Mutex::Locker locker (m_profile_data_comm_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_profile_data_comm_mutex);
     m_profile_data.push_back(one_profile_data);
     BroadcastEventIfUnique (eBroadcastBitProfileData, new ProcessEventData (shared_from_this(), GetState()));
 }
@@ -4807,7 +4801,7 @@ Process::BroadcastAsyncProfileData(const
 size_t
 Process::GetAsyncProfileData (char *buf, size_t buf_size, Error &error)
 {
-    Mutex::Locker locker(m_profile_data_comm_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_profile_data_comm_mutex);
     if (m_profile_data.empty())
         return 0;
     
@@ -4842,7 +4836,7 @@ Process::GetAsyncProfileData (char *buf,
 size_t
 Process::GetSTDOUT (char *buf, size_t buf_size, Error &error)
 {
-    Mutex::Locker locker(m_stdio_communication_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_stdio_communication_mutex);
     size_t bytes_available = m_stdout_data.size();
     if (bytes_available > 0)
     {
@@ -4869,7 +4863,7 @@ Process::GetSTDOUT (char *buf, size_t bu
 size_t
 Process::GetSTDERR (char *buf, size_t buf_size, Error &error)
 {
-    Mutex::Locker locker(m_stdio_communication_mutex);
+    std::lock_guard<std::recursive_mutex> gaurd(m_stdio_communication_mutex);
     size_t bytes_available = m_stderr_data.size();
     if (bytes_available > 0)
     {
@@ -6105,7 +6099,7 @@ Process::RunThreadPlan(ExecutionContext
             if (GetThreadList().SetSelectedThreadByIndexID (selected_tid) && selected_stack_id.IsValid())
             {
                 // We were able to restore the selected thread, now restore the frame:
-                Mutex::Locker lock(GetThreadList().GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(GetThreadList().GetMutex());
                 StackFrameSP old_frame_sp = GetThreadList().GetSelectedThread()->GetFrameWithStackID(selected_stack_id);
                 if (old_frame_sp)
                     GetThreadList().GetSelectedThread()->SetSelectedFrame(old_frame_sp.get());
@@ -6210,7 +6204,7 @@ Process::GetThreadStatus (Stream &strm,
     std::vector<lldb::tid_t> thread_id_array;
     //Scope for thread list locker;
     {
-        Mutex::Locker locker (GetThreadList().GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetThreadList().GetMutex());
         ThreadList &curr_thread_list = GetThreadList();
         num_threads = curr_thread_list.GetSize();
         uint32_t idx;

Modified: lldb/trunk/source/Target/QueueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/QueueList.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/QueueList.cpp (original)
+++ lldb/trunk/source/Target/QueueList.cpp Thu May 19 00:13:57 2016
@@ -14,11 +14,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-QueueList::QueueList (Process *process) :
-    m_process (process),
-    m_stop_id (0),
-    m_queues (),
-    m_mutex ()
+QueueList::QueueList(Process *process) : m_process(process), m_stop_id(0), m_queues(), m_mutex()
 {
 }
 
@@ -30,14 +26,14 @@ QueueList::~QueueList ()
 uint32_t
 QueueList::GetSize ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     return m_queues.size();
 }
 
 lldb::QueueSP
 QueueList::GetQueueAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (idx < m_queues.size())
     {
         return m_queues[idx];
@@ -51,14 +47,14 @@ QueueList::GetQueueAtIndex (uint32_t idx
 void
 QueueList::Clear ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     m_queues.clear();
 }
 
 void
 QueueList::AddQueue (QueueSP queue_sp)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (queue_sp.get ())
     {
         m_queues.push_back (queue_sp);
@@ -95,8 +91,8 @@ QueueList::FindQueueByIndexID (uint32_t
     return ret;
 }
 
-lldb_private::Mutex &
-QueueList::GetMutex ()
+std::mutex &
+QueueList::GetMutex()
 {
     return m_mutex;
 }

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Thu May 19 00:13:57 2016
@@ -44,135 +44,119 @@ using namespace lldb_private;
 #define RESOLVED_VARIABLES              (GOT_FRAME_BASE << 1)
 #define RESOLVED_GLOBAL_VARIABLES       (RESOLVED_VARIABLES << 1)
 
-StackFrame::StackFrame (const ThreadSP &thread_sp, 
-                        user_id_t frame_idx, 
-                        user_id_t unwind_frame_index, 
-                        addr_t cfa, 
-                        bool cfa_is_valid,
-                        addr_t pc, 
-                        uint32_t stop_id,
-                        bool stop_id_is_valid,
-                        bool is_history_frame,
-                        const SymbolContext *sc_ptr) :
-    m_thread_wp (thread_sp),
-    m_frame_index (frame_idx),
-    m_concrete_frame_index (unwind_frame_index),    
-    m_reg_context_sp (),
-    m_id(pc, cfa, nullptr),
-    m_frame_code_addr (pc),
-    m_sc (),
-    m_flags (),
-    m_frame_base (),
-    m_frame_base_error (),
-    m_cfa_is_valid (cfa_is_valid),
-    m_stop_id  (stop_id),
-    m_stop_id_is_valid (stop_id_is_valid),
-    m_is_history_frame (is_history_frame),
-    m_variable_list_sp (),
-    m_variable_list_value_objects (),
-    m_disassembly (),
-    m_mutex (Mutex::eMutexTypeRecursive)
+StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx, user_id_t unwind_frame_index, addr_t cfa,
+                       bool cfa_is_valid, addr_t pc, uint32_t stop_id, bool stop_id_is_valid, bool is_history_frame,
+                       const SymbolContext *sc_ptr)
+    : m_thread_wp(thread_sp),
+      m_frame_index(frame_idx),
+      m_concrete_frame_index(unwind_frame_index),
+      m_reg_context_sp(),
+      m_id(pc, cfa, nullptr),
+      m_frame_code_addr(pc),
+      m_sc(),
+      m_flags(),
+      m_frame_base(),
+      m_frame_base_error(),
+      m_cfa_is_valid(cfa_is_valid),
+      m_stop_id(stop_id),
+      m_stop_id_is_valid(stop_id_is_valid),
+      m_is_history_frame(is_history_frame),
+      m_variable_list_sp(),
+      m_variable_list_value_objects(),
+      m_disassembly(),
+      m_mutex()
 {
     // If we don't have a CFA value, use the frame index for our StackID so that recursive
     // functions properly aren't confused with one another on a history stack.
     if (m_is_history_frame && !m_cfa_is_valid)
     {
-        m_id.SetCFA (m_frame_index);
+        m_id.SetCFA(m_frame_index);
     }
 
     if (sc_ptr != nullptr)
     {
         m_sc = *sc_ptr;
-        m_flags.Set(m_sc.GetResolvedMask ());
+        m_flags.Set(m_sc.GetResolvedMask());
     }
 }
 
-StackFrame::StackFrame (const ThreadSP &thread_sp, 
-                        user_id_t frame_idx, 
-                        user_id_t unwind_frame_index, 
-                        const RegisterContextSP &reg_context_sp, 
-                        addr_t cfa, 
-                        addr_t pc, 
-                        const SymbolContext *sc_ptr) :
-    m_thread_wp (thread_sp),
-    m_frame_index (frame_idx),
-    m_concrete_frame_index (unwind_frame_index),    
-    m_reg_context_sp (reg_context_sp),
-    m_id(pc, cfa, nullptr),
-    m_frame_code_addr (pc),
-    m_sc (),
-    m_flags (),
-    m_frame_base (),
-    m_frame_base_error (),
-    m_cfa_is_valid (true),
-    m_stop_id  (0),
-    m_stop_id_is_valid (false),
-    m_is_history_frame (false),
-    m_variable_list_sp (),
-    m_variable_list_value_objects (),
-    m_disassembly (),
-    m_mutex (Mutex::eMutexTypeRecursive)
+StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx, user_id_t unwind_frame_index,
+                       const RegisterContextSP &reg_context_sp, addr_t cfa, addr_t pc, const SymbolContext *sc_ptr)
+    : m_thread_wp(thread_sp),
+      m_frame_index(frame_idx),
+      m_concrete_frame_index(unwind_frame_index),
+      m_reg_context_sp(reg_context_sp),
+      m_id(pc, cfa, nullptr),
+      m_frame_code_addr(pc),
+      m_sc(),
+      m_flags(),
+      m_frame_base(),
+      m_frame_base_error(),
+      m_cfa_is_valid(true),
+      m_stop_id(0),
+      m_stop_id_is_valid(false),
+      m_is_history_frame(false),
+      m_variable_list_sp(),
+      m_variable_list_value_objects(),
+      m_disassembly(),
+      m_mutex()
 {
     if (sc_ptr != nullptr)
     {
         m_sc = *sc_ptr;
-        m_flags.Set(m_sc.GetResolvedMask ());
+        m_flags.Set(m_sc.GetResolvedMask());
     }
-    
+
     if (reg_context_sp && !m_sc.target_sp)
     {
         m_sc.target_sp = reg_context_sp->CalculateTarget();
         if (m_sc.target_sp)
-            m_flags.Set (eSymbolContextTarget);
+            m_flags.Set(eSymbolContextTarget);
     }
 }
 
-StackFrame::StackFrame (const ThreadSP &thread_sp, 
-                        user_id_t frame_idx, 
-                        user_id_t unwind_frame_index, 
-                        const RegisterContextSP &reg_context_sp, 
-                        addr_t cfa, 
-                        const Address& pc_addr,
-                        const SymbolContext *sc_ptr) :
-    m_thread_wp (thread_sp),
-    m_frame_index (frame_idx),
-    m_concrete_frame_index (unwind_frame_index),    
-    m_reg_context_sp (reg_context_sp),
-    m_id(pc_addr.GetLoadAddress(thread_sp->CalculateTarget().get()), cfa, nullptr),
-    m_frame_code_addr (pc_addr),
-    m_sc (),
-    m_flags (),
-    m_frame_base (),
-    m_frame_base_error (),
-    m_cfa_is_valid (true),
-    m_stop_id  (0),
-    m_stop_id_is_valid (false),
-    m_is_history_frame (false),
-    m_variable_list_sp (),
-    m_variable_list_value_objects (),
-    m_disassembly (),
-    m_mutex (Mutex::eMutexTypeRecursive)
+StackFrame::StackFrame(const ThreadSP &thread_sp, user_id_t frame_idx, user_id_t unwind_frame_index,
+                       const RegisterContextSP &reg_context_sp, addr_t cfa, const Address &pc_addr,
+                       const SymbolContext *sc_ptr)
+    : m_thread_wp(thread_sp),
+      m_frame_index(frame_idx),
+      m_concrete_frame_index(unwind_frame_index),
+      m_reg_context_sp(reg_context_sp),
+      m_id(pc_addr.GetLoadAddress(thread_sp->CalculateTarget().get()), cfa, nullptr),
+      m_frame_code_addr(pc_addr),
+      m_sc(),
+      m_flags(),
+      m_frame_base(),
+      m_frame_base_error(),
+      m_cfa_is_valid(true),
+      m_stop_id(0),
+      m_stop_id_is_valid(false),
+      m_is_history_frame(false),
+      m_variable_list_sp(),
+      m_variable_list_value_objects(),
+      m_disassembly(),
+      m_mutex()
 {
     if (sc_ptr != nullptr)
     {
         m_sc = *sc_ptr;
-        m_flags.Set(m_sc.GetResolvedMask ());
+        m_flags.Set(m_sc.GetResolvedMask());
     }
-    
+
     if (!m_sc.target_sp && reg_context_sp)
     {
         m_sc.target_sp = reg_context_sp->CalculateTarget();
         if (m_sc.target_sp)
-            m_flags.Set (eSymbolContextTarget);
+            m_flags.Set(eSymbolContextTarget);
     }
-    
-    ModuleSP pc_module_sp (pc_addr.GetModule());
+
+    ModuleSP pc_module_sp(pc_addr.GetModule());
     if (!m_sc.module_sp || m_sc.module_sp != pc_module_sp)
     {
         if (pc_module_sp)
         {
             m_sc.module_sp = pc_module_sp;
-            m_flags.Set (eSymbolContextModule);
+            m_flags.Set(eSymbolContextModule);
         }
         else
         {
@@ -186,7 +170,7 @@ StackFrame::~StackFrame() = default;
 StackID&
 StackFrame::GetStackID()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // Make sure we have resolved the StackID object's symbol context scope if
     // we already haven't looked it up.
 
@@ -233,7 +217,7 @@ StackFrame::GetFrameIndex () const
 void
 StackFrame::SetSymbolContextScope (SymbolContextScope *symbol_scope)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
     m_id.SetSymbolContextScope (symbol_scope);
 }
@@ -241,7 +225,7 @@ StackFrame::SetSymbolContextScope (Symbo
 const Address&
 StackFrame::GetFrameCodeAddress()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR) && !m_frame_code_addr.IsSectionOffset())
     {
         m_flags.Set (RESOLVED_FRAME_CODE_ADDR);
@@ -272,7 +256,7 @@ StackFrame::GetFrameCodeAddress()
 bool
 StackFrame::ChangePC (addr_t pc)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // We can't change the pc value of a history stack frame - it is immutable.
     if (m_is_history_frame)
         return false;
@@ -288,7 +272,7 @@ StackFrame::ChangePC (addr_t pc)
 const char *
 StackFrame::Disassemble ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_disassembly.GetSize() == 0)
     {
         ExecutionContext exe_ctx (shared_from_this());
@@ -348,7 +332,7 @@ StackFrame::GetFrameBlock ()
 const SymbolContext&
 StackFrame::GetSymbolContext (uint32_t resolve_scope)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // Copy our internal symbol context into "sc".
     if ((m_flags.Get() & resolve_scope) != resolve_scope)
     {
@@ -521,7 +505,7 @@ StackFrame::GetSymbolContext (uint32_t r
 VariableList *
 StackFrame::GetVariableList (bool get_file_globals)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_flags.IsClear(RESOLVED_VARIABLES))
     {
         m_flags.Set(RESOLVED_VARIABLES);
@@ -566,7 +550,7 @@ StackFrame::GetVariableList (bool get_fi
 VariableListSP
 StackFrame::GetInScopeVariableList (bool get_file_globals, bool must_have_valid_location)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // We can't fetch variable information for a history stack frame.
     if (m_is_history_frame)
         return VariableListSP();
@@ -1197,7 +1181,7 @@ StackFrame::GetValueForVariableExpressio
 bool
 StackFrame::GetFrameBaseValue (Scalar &frame_base, Error *error_ptr)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_cfa_is_valid)
     {
         m_frame_base_error.SetErrorString("No frame base available for this historical stack frame.");
@@ -1255,7 +1239,7 @@ StackFrame::GetFrameBaseValue (Scalar &f
 RegisterContextSP
 StackFrame::GetRegisterContext ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_reg_context_sp)
     {
         ThreadSP thread_sp (GetThread());
@@ -1275,7 +1259,7 @@ StackFrame::HasDebugInformation ()
 ValueObjectSP
 StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     ValueObjectSP valobj_sp;
     if (m_is_history_frame)
     {
@@ -1311,7 +1295,7 @@ StackFrame::GetValueObjectForFrameVariab
 ValueObjectSP
 StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_is_history_frame)
         return ValueObjectSP();
 
@@ -1471,7 +1455,7 @@ StackFrame::Dump (Stream *strm, bool sho
 void
 StackFrame::UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     assert (GetStackID() == prev_frame.GetStackID());    // TODO: remove this after some testing
     m_variable_list_sp = prev_frame.m_variable_list_sp;
     m_variable_list_value_objects.Swap (prev_frame.m_variable_list_value_objects);
@@ -1482,7 +1466,7 @@ StackFrame::UpdateCurrentFrameFromPrevio
 void
 StackFrame::UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     assert (GetStackID() == curr_frame.GetStackID());        // TODO: remove this after some testing
     m_id.SetPC (curr_frame.m_id.GetPC());       // Update the Stack ID PC value
     assert (GetThread() == curr_frame.GetThread());

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Thu May 19 00:13:57 2016
@@ -36,26 +36,21 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // StackFrameList constructor
 //----------------------------------------------------------------------
-StackFrameList::StackFrameList
-(
-    Thread &thread, 
-    const lldb::StackFrameListSP &prev_frames_sp, 
-    bool show_inline_frames
-) :
-    m_thread (thread),
-    m_prev_frames_sp (prev_frames_sp),
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_frames (),
-    m_selected_frame_idx (0),
-    m_concrete_frames_fetched (0),
-    m_current_inlined_depth (UINT32_MAX),
-    m_current_inlined_pc (LLDB_INVALID_ADDRESS),
-    m_show_inlined_frames (show_inline_frames)
+StackFrameList::StackFrameList(Thread &thread, const lldb::StackFrameListSP &prev_frames_sp, bool show_inline_frames)
+    : m_thread(thread),
+      m_prev_frames_sp(prev_frames_sp),
+      m_mutex(),
+      m_frames(),
+      m_selected_frame_idx(0),
+      m_concrete_frames_fetched(0),
+      m_current_inlined_depth(UINT32_MAX),
+      m_current_inlined_pc(LLDB_INVALID_ADDRESS),
+      m_show_inlined_frames(show_inline_frames)
 {
     if (prev_frames_sp)
     {
         m_current_inlined_depth = prev_frames_sp->m_current_inlined_depth;
-        m_current_inlined_pc =    prev_frames_sp->m_current_inlined_pc;
+        m_current_inlined_pc = prev_frames_sp->m_current_inlined_pc;
     }
 }
 
@@ -101,7 +96,7 @@ StackFrameList::GetCurrentInlinedDepth (
 void
 StackFrameList::ResetCurrentInlinedDepth ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (m_show_inlined_frames)
     {        
@@ -485,7 +480,7 @@ StackFrameList::GetFramesUpTo(uint32_t e
 uint32_t
 StackFrameList::GetNumFrames (bool can_create)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (can_create)
         GetFramesUpTo (UINT32_MAX);
@@ -502,7 +497,8 @@ StackFrameList::Dump (Stream *s)
 {
     if (s == nullptr)
         return;
-    Mutex::Locker locker (m_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     const_iterator pos, begin = m_frames.begin(), end = m_frames.end();
     for (pos = begin; pos != end; ++pos)
@@ -525,7 +521,7 @@ StackFrameSP
 StackFrameList::GetFrameAtIndex (uint32_t idx)
 {
     StackFrameSP frame_sp;
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     uint32_t original_idx = idx;
     
     uint32_t inlined_depth = GetCurrentInlinedDepth();
@@ -634,7 +630,7 @@ StackFrameList::GetFrameWithStackID (con
     
     if (stack_id.IsValid())
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         uint32_t frame_idx = 0;
         // Do a binary search in case the stack frame is already in our cache
         collection::const_iterator begin = m_frames.begin();
@@ -680,14 +676,14 @@ StackFrameList::SetFrameAtIndex (uint32_
 uint32_t
 StackFrameList::GetSelectedFrameIndex () const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_selected_frame_idx;
 }
 
 uint32_t
 StackFrameList::SetSelectedFrame (lldb_private::StackFrame *frame)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const_iterator pos;
     const_iterator begin = m_frames.begin();
     const_iterator end = m_frames.end();
@@ -711,7 +707,7 @@ StackFrameList::SetSelectedFrame (lldb_p
 bool
 StackFrameList::SetSelectedFrameByIndex (uint32_t idx)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     StackFrameSP frame_sp (GetFrameAtIndex (idx));
     if (frame_sp)
     {
@@ -743,7 +739,7 @@ StackFrameList::SetDefaultFileAndLineToS
 void
 StackFrameList::Clear ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_frames.clear();
     m_concrete_frames_fetched = 0;
 }
@@ -751,7 +747,7 @@ StackFrameList::Clear ()
 void
 StackFrameList::InvalidateFrames (uint32_t start_idx)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_show_inlined_frames)
     {
         Clear();
@@ -770,8 +766,11 @@ StackFrameList::InvalidateFrames (uint32
 void
 StackFrameList::Merge (std::unique_ptr<StackFrameList>& curr_ap, lldb::StackFrameListSP& prev_sp)
 {
-    Mutex::Locker curr_locker(curr_ap ? &curr_ap->m_mutex : nullptr);
-    Mutex::Locker prev_locker(prev_sp ? &prev_sp->m_mutex : nullptr);
+    std::unique_lock<std::recursive_mutex> current_lock, previous_lock;
+    if (curr_ap)
+        current_lock = std::unique_lock<std::recursive_mutex>(curr_ap->m_mutex);
+    if (prev_sp)
+        previous_lock = std::unique_lock<std::recursive_mutex>(prev_sp->m_mutex);
 
 #if defined (DEBUG_STACK_FRAMES)
     StreamFile s(stdout, false);

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu May 19 00:13:57 2016
@@ -68,45 +68,47 @@ Target::GetStaticBroadcasterClass ()
     return class_name;
 }
 
-Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp, bool is_dummy_target) :
-    TargetProperties (this),
-    Broadcaster (debugger.GetBroadcasterManager(), Target::GetStaticBroadcasterClass().AsCString()),
-    ExecutionContextScope (),
-    m_debugger (debugger),
-    m_platform_sp (platform_sp),
-    m_mutex (Mutex::eMutexTypeRecursive), 
-    m_arch (target_arch),
-    m_images (this),
-    m_section_load_history (),
-    m_breakpoint_list (false),
-    m_internal_breakpoint_list (true),
-    m_watchpoint_list (),
-    m_process_sp (),
-    m_search_filter_sp (),
-    m_image_search_paths (ImageSearchPathsChanged, this),
-    m_ast_importer_sp (),
-    m_source_manager_ap(),
-    m_stop_hooks (),
-    m_stop_hook_next_id (0),
-    m_valid (true),
-    m_suppress_stop_hooks (false),
-    m_is_dummy_target(is_dummy_target)
-
-{
-    SetEventName (eBroadcastBitBreakpointChanged, "breakpoint-changed");
-    SetEventName (eBroadcastBitModulesLoaded, "modules-loaded");
-    SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded");
-    SetEventName (eBroadcastBitWatchpointChanged, "watchpoint-changed");
-    SetEventName (eBroadcastBitSymbolsLoaded, "symbols-loaded");
+Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp,
+               bool is_dummy_target)
+    : TargetProperties(this),
+      Broadcaster(debugger.GetBroadcasterManager(), Target::GetStaticBroadcasterClass().AsCString()),
+      ExecutionContextScope(),
+      m_debugger(debugger),
+      m_platform_sp(platform_sp),
+      m_mutex(),
+      m_arch(target_arch),
+      m_images(this),
+      m_section_load_history(),
+      m_breakpoint_list(false),
+      m_internal_breakpoint_list(true),
+      m_watchpoint_list(),
+      m_process_sp(),
+      m_search_filter_sp(),
+      m_image_search_paths(ImageSearchPathsChanged, this),
+      m_ast_importer_sp(),
+      m_source_manager_ap(),
+      m_stop_hooks(),
+      m_stop_hook_next_id(0),
+      m_valid(true),
+      m_suppress_stop_hooks(false),
+      m_is_dummy_target(is_dummy_target)
+
+{
+    SetEventName(eBroadcastBitBreakpointChanged, "breakpoint-changed");
+    SetEventName(eBroadcastBitModulesLoaded, "modules-loaded");
+    SetEventName(eBroadcastBitModulesUnloaded, "modules-unloaded");
+    SetEventName(eBroadcastBitWatchpointChanged, "watchpoint-changed");
+    SetEventName(eBroadcastBitSymbolsLoaded, "symbols-loaded");
 
     CheckInWithManager();
 
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
     if (log)
-        log->Printf ("%p Target::Target()", static_cast<void*>(this));
+        log->Printf("%p Target::Target()", static_cast<void *>(this));
     if (m_arch.IsValid())
     {
-        LogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET, "Target::Target created with architecture %s (%s)", m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
+        LogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET, "Target::Target created with architecture %s (%s)",
+                              m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
     }
 }
 
@@ -169,8 +171,8 @@ Target::CleanupProcess ()
     m_breakpoint_list.ClearAllBreakpointSites();
     m_internal_breakpoint_list.ClearAllBreakpointSites();
     // Disable watchpoints just on the debugger side.
-    Mutex::Locker locker;
-    this->GetWatchpointList().GetListMutex(locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    this->GetWatchpointList().GetListMutex(lock);
     DisableAllWatchpoints(false);
     ClearAllWatchpointHitCounts();
     ClearAllWatchpointHistoricValues();
@@ -273,7 +275,7 @@ Target::SetREPL (lldb::LanguageType lang
 void
 Target::Destroy()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_valid = false;
     DeleteCurrentProcess ();
     m_platform_sp.reset();
@@ -753,8 +755,8 @@ Target::CreateWatchpoint(lldb::addr_t ad
 
     // Grab the list mutex while doing operations.
     const bool notify = false;   // Don't notify about all the state changes we do on creating the watchpoint.
-    Mutex::Locker locker;
-    this->GetWatchpointList().GetListMutex(locker);
+    std::unique_lock<std::recursive_mutex> lock;
+    this->GetWatchpointList().GetListMutex(lock);
     WatchpointSP matched_sp = m_watchpoint_list.FindByAddress(addr);
     if (matched_sp)
     {

Modified: lldb/trunk/source/Target/ThreadCollection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadCollection.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadCollection.cpp (original)
+++ lldb/trunk/source/Target/ThreadCollection.cpp Thu May 19 00:13:57 2016
@@ -30,14 +30,14 @@ ThreadCollection::ThreadCollection(colle
 void
 ThreadCollection::AddThread (const ThreadSP &thread_sp)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     m_threads.push_back (thread_sp);
 }
 
 void
 ThreadCollection::InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     if (idx < m_threads.size())
         m_threads.insert(m_threads.begin() + idx, thread_sp);
     else
@@ -47,14 +47,14 @@ ThreadCollection::InsertThread (const ll
 uint32_t
 ThreadCollection::GetSize ()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     return m_threads.size();
 }
 
 ThreadSP
 ThreadCollection::GetThreadAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     ThreadSP thread_sp;
     if (idx < m_threads.size())
         thread_sp = m_threads[idx];

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=270024&r1=270023&r2=270024&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Thu May 19 00:13:57 2016
@@ -53,7 +53,8 @@ ThreadList::operator = (const ThreadList
     {
         // Lock both mutexes to make sure neither side changes anyone on us
         // while the assignment occurs
-        Mutex::Locker locker(GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
         m_process = rhs.m_process;
         m_stop_id = rhs.m_stop_id;
         m_threads = rhs.m_threads;
@@ -111,7 +112,8 @@ ThreadList::SetStopID (uint32_t stop_id)
 uint32_t
 ThreadList::GetSize (bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
     return m_threads.size();
@@ -120,7 +122,8 @@ ThreadList::GetSize (bool can_update)
 ThreadSP
 ThreadList::GetThreadAtIndex (uint32_t idx, bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
 
@@ -133,7 +136,7 @@ ThreadList::GetThreadAtIndex (uint32_t i
 ThreadSP
 ThreadList::FindThreadByID (lldb::tid_t tid, bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
@@ -155,8 +158,8 @@ ThreadList::FindThreadByID (lldb::tid_t
 ThreadSP
 ThreadList::FindThreadByProtocolID (lldb::tid_t tid, bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
     
@@ -178,8 +181,8 @@ ThreadList::FindThreadByProtocolID (lldb
 ThreadSP
 ThreadList::RemoveThreadByID (lldb::tid_t tid, bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
     
@@ -201,8 +204,8 @@ ThreadList::RemoveThreadByID (lldb::tid_
 ThreadSP
 ThreadList::RemoveThreadByProtocolID (lldb::tid_t tid, bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
-    
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
     
@@ -227,7 +230,7 @@ ThreadList::GetThreadSPForThreadPtr (Thr
     ThreadSP thread_sp;
     if (thread_ptr)
     {
-        Mutex::Locker locker(GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
         uint32_t idx = 0;
         const uint32_t num_threads = m_threads.size();
@@ -248,7 +251,7 @@ ThreadList::GetThreadSPForThreadPtr (Thr
 ThreadSP
 ThreadList::FindThreadByIndexID (uint32_t index_id, bool can_update)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
     if (can_update)
         m_process->UpdateThreadListIfNeeded();
@@ -284,7 +287,7 @@ ThreadList::ShouldStop (Event *event_ptr
     collection threads_copy;
     {
         // Scope for locker
-        Mutex::Locker locker(GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
         m_process->UpdateThreadListIfNeeded();
         for (lldb::ThreadSP thread_sp : m_threads)
@@ -395,7 +398,7 @@ ThreadList::ShouldStop (Event *event_ptr
 Vote
 ThreadList::ShouldReportStop (Event *event_ptr)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
     Vote result = eVoteNoOpinion;
     m_process->UpdateThreadListIfNeeded();
@@ -446,7 +449,8 @@ ThreadList::ShouldReportStop (Event *eve
 void
 ThreadList::SetShouldReportStop (Vote vote)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
     m_process->UpdateThreadListIfNeeded();
     collection::iterator pos, end = m_threads.end();
     for (pos = m_threads.begin(); pos != end; ++pos)
@@ -460,7 +464,7 @@ Vote
 ThreadList::ShouldReportRun (Event *event_ptr)
 {
 
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
     Vote result = eVoteNoOpinion;
     m_process->UpdateThreadListIfNeeded();
@@ -499,7 +503,7 @@ ThreadList::ShouldReportRun (Event *even
 void
 ThreadList::Clear()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     m_stop_id = 0;
     m_threads.clear();
     m_selected_tid = LLDB_INVALID_THREAD_ID;
@@ -508,7 +512,7 @@ ThreadList::Clear()
 void
 ThreadList::Destroy()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     const uint32_t num_threads = m_threads.size();
     for (uint32_t idx = 0; idx < num_threads; ++idx)
     {
@@ -519,7 +523,7 @@ ThreadList::Destroy()
 void
 ThreadList::RefreshStateAfterStop ()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
     m_process->UpdateThreadListIfNeeded();
     
@@ -537,7 +541,7 @@ ThreadList::DiscardThreadPlans ()
 {
     // You don't need to update the thread list here, because only threads
     // that you currently know about have any thread plans.
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
 
     collection::iterator pos, end = m_threads.end();
     for (pos = m_threads.begin(); pos != end; ++pos)
@@ -552,7 +556,7 @@ ThreadList::WillResume ()
     // But we only do this for threads that are running, user suspended
     // threads stay where they are.
 
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     m_process->UpdateThreadListIfNeeded();
 
     collection::iterator pos, end = m_threads.end();
@@ -700,7 +704,7 @@ ThreadList::WillResume ()
 void
 ThreadList::DidResume ()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     collection::iterator pos, end = m_threads.end();
     for (pos = m_threads.begin(); pos != end; ++pos)
     {
@@ -715,7 +719,7 @@ ThreadList::DidResume ()
 void
 ThreadList::DidStop ()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     collection::iterator pos, end = m_threads.end();
     for (pos = m_threads.begin(); pos != end; ++pos)
     {
@@ -736,7 +740,7 @@ ThreadList::DidStop ()
 ThreadSP
 ThreadList::GetSelectedThread ()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     ThreadSP thread_sp = FindThreadByID(m_selected_tid);
     if (!thread_sp.get())
     {
@@ -751,7 +755,7 @@ ThreadList::GetSelectedThread ()
 bool
 ThreadList::SetSelectedThreadByID (lldb::tid_t tid, bool notify)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     ThreadSP selected_thread_sp(FindThreadByID(tid));
     if  (selected_thread_sp)
     {
@@ -770,7 +774,7 @@ ThreadList::SetSelectedThreadByID (lldb:
 bool
 ThreadList::SetSelectedThreadByIndexID (uint32_t index_id, bool notify)
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     ThreadSP selected_thread_sp (FindThreadByIndexID(index_id));
     if  (selected_thread_sp.get())
     {
@@ -802,7 +806,8 @@ ThreadList::Update (ThreadList &rhs)
     {
         // Lock both mutexes to make sure neither side changes anyone on us
         // while the assignment occurs
-        Mutex::Locker locker(GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetMutex());
+
         m_process = rhs.m_process;
         m_stop_id = rhs.m_stop_id;
         m_threads.swap(rhs.m_threads);
@@ -840,14 +845,14 @@ ThreadList::Update (ThreadList &rhs)
 void
 ThreadList::Flush ()
 {
-    Mutex::Locker locker(GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetMutex());
     collection::iterator pos, end = m_threads.end();
     for (pos = m_threads.begin(); pos != end; ++pos)
         (*pos)->Flush ();
 }
 
-Mutex &
-ThreadList::GetMutex ()
+std::recursive_mutex &
+ThreadList::GetMutex()
 {
     return m_process->m_thread_mutex;
 }




More information about the lldb-commits mailing list