[Lldb-commits] [lldb] r269877 - remove use of Mutex in favour of std::{, recursive_}mutex

Saleem Abdulrasool via lldb-commits lldb-commits at lists.llvm.org
Tue May 17 18:59:13 PDT 2016


Author: compnerd
Date: Tue May 17 20:59:10 2016
New Revision: 269877

URL: http://llvm.org/viewvc/llvm-project?rev=269877&view=rev
Log:
remove use of Mutex in favour of std::{,recursive_}mutex

This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h
    lldb/trunk/include/lldb/Core/Broadcaster.h
    lldb/trunk/include/lldb/Core/Communication.h
    lldb/trunk/include/lldb/Core/History.h
    lldb/trunk/include/lldb/Core/IOHandler.h
    lldb/trunk/include/lldb/Core/Listener.h
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Core/ModuleSpec.h
    lldb/trunk/include/lldb/Core/StreamCallback.h
    lldb/trunk/include/lldb/Core/StreamTee.h
    lldb/trunk/include/lldb/Core/ThreadSafeSTLMap.h
    lldb/trunk/include/lldb/Core/ThreadSafeValue.h
    lldb/trunk/include/lldb/Core/UserSettingsController.h
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/include/lldb/DataFormatters/FormatCache.h
    lldb/trunk/include/lldb/DataFormatters/FormatManager.h
    lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
    lldb/trunk/include/lldb/DataFormatters/TypeCategory.h
    lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h
    lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
    lldb/trunk/include/lldb/Host/Editline.h
    lldb/trunk/include/lldb/Host/ProcessRunLock.h
    lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
    lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
    lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
    lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h
    lldb/trunk/include/lldb/Interpreter/CommandHistory.h
    lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h
    lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
    lldb/trunk/include/lldb/Target/JITLoaderList.h
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/include/lldb/Target/SectionLoadHistory.h
    lldb/trunk/include/lldb/Target/SectionLoadList.h
    lldb/trunk/include/lldb/Target/TargetList.h
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/include/lldb/Target/ThreadPlan.h
    lldb/trunk/include/lldb/Target/ThreadPlanPython.h
    lldb/trunk/include/lldb/Target/Unwind.h
    lldb/trunk/include/lldb/Utility/SharedCluster.h
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp
    lldb/trunk/source/Breakpoint/BreakpointSite.cpp
    lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Core/Broadcaster.cpp
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/IOHandler.cpp
    lldb/trunk/source/Core/Listener.cpp
    lldb/trunk/source/Core/Log.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/PluginManager.cpp
    lldb/trunk/source/Core/StreamCallback.cpp
    lldb/trunk/source/Core/Timer.cpp
    lldb/trunk/source/DataFormatters/FormatCache.cpp
    lldb/trunk/source/DataFormatters/FormatManager.cpp
    lldb/trunk/source/DataFormatters/TypeCategory.cpp
    lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
    lldb/trunk/source/Expression/IRExecutionUnit.cpp
    lldb/trunk/source/Host/common/Editline.cpp
    lldb/trunk/source/Host/common/NativeBreakpointList.cpp
    lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
    lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
    lldb/trunk/source/Initialization/SystemLifetimeManager.cpp
    lldb/trunk/source/Interpreter/CommandHistory.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
    lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
    lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
    lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
    lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
    lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp
    lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h
    lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp
    lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
    lldb/trunk/source/Symbol/FuncUnwinders.cpp
    lldb/trunk/source/Symbol/ObjectFile.cpp
    lldb/trunk/source/Symbol/SymbolVendor.cpp
    lldb/trunk/source/Target/JITLoaderList.cpp
    lldb/trunk/source/Target/Language.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/SectionLoadHistory.cpp
    lldb/trunk/source/Target/SectionLoadList.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/TargetList.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlan.cpp
    lldb/trunk/source/Utility/SharingPtr.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h Tue May 17 20:59:10 2016
@@ -13,13 +13,13 @@
 // C Includes
 // C++ Includes
 #include <map>
+#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"
 #include "lldb/Utility/Iterable.h"
 
 namespace lldb_private {
@@ -270,7 +270,7 @@ protected:
     Breakpoint &m_owner;
     collection m_locations;         // Vector of locations, sorted by ID 
     addr_map m_address_to_location;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
     lldb::break_id_t m_next_id;
     BreakpointLocationCollection *m_new_location_recorder;
 

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Tue May 17 20:59:10 2016
@@ -14,12 +14,12 @@
 
 // C++ Includes
 #include <list>
+#include <mutex>
 
 // Other libraries and framework includes
 
 // Project includes
 #include "lldb/lldb-forward.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Core/UserID.h"
 #include "lldb/Breakpoint/StoppointLocation.h"
 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
@@ -297,7 +297,7 @@ private:
     // Consider adding an optimization where if there is only one
     // owner, we don't store a list.  The usual case will be only one owner...
     BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site.
-    Mutex m_owners_mutex;      ///< This mutex protects the owners collection. 
+    std::recursive_mutex m_owners_mutex;   ///< This mutex protects the owners collection.
 
     static lldb::break_id_t
     GetNextID();

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSiteList.h Tue May 17 20:59:10 2016
@@ -12,12 +12,13 @@
 
 // C Includes
 // C++ Includes
-#include <map>
 #include <functional>
+#include <map>
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Breakpoint/BreakpointSite.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -189,16 +190,17 @@ public:
     size_t
     GetSize() const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_bp_site_list.size();
     }
 
     bool
     IsEmpty() const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_bp_site_list.empty();
     }
+
 protected:
     typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
 
@@ -208,7 +210,7 @@ protected:
     collection::const_iterator
     GetIDConstIterator(lldb::break_id_t breakID) const;
 
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
     collection m_bp_site_list;  // The breakpoint site list.
 };
 

Modified: lldb/trunk/include/lldb/Core/Broadcaster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Broadcaster.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Broadcaster.h (original)
+++ lldb/trunk/include/lldb/Core/Broadcaster.h Tue May 17 20:59:10 2016
@@ -15,6 +15,7 @@
 #include <functional>
 #include <list>
 #include <map>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -22,7 +23,6 @@
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -126,8 +126,8 @@ private:
     typedef std::set<lldb::ListenerSP> listener_collection;
     collection m_event_map;
     listener_collection m_listeners;
-    
-    Mutex m_manager_mutex;
+
+    mutable std::recursive_mutex m_manager_mutex;
 
     // A couple of comparator classes for find_if:
     
@@ -625,7 +625,7 @@ protected:
         Broadcaster &m_broadcaster;                     ///< The broadcsater that this implements
         event_names_map m_event_names;                  ///< Optionally define event names for readability and logging for each event bit
         collection m_listeners;                         ///< A list of Listener / event_mask pairs that are listening to this broadcaster.
-        Mutex m_listeners_mutex;                        ///< A mutex that protects \a m_listeners.
+        std::recursive_mutex m_listeners_mutex;         ///< A mutex that protects \a m_listeners.
         std::vector<lldb::ListenerSP> m_hijacking_listeners;  // A simple mechanism to intercept events from a broadcaster
         std::vector<uint32_t> m_hijacking_masks;        // At some point we may want to have a stack or Listener
                                                         // collections, but for now this is just for private hijacking.

Modified: lldb/trunk/include/lldb/Core/Communication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Communication.h (original)
+++ lldb/trunk/include/lldb/Core/Communication.h Tue May 17 20:59:10 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <atomic>
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
@@ -21,7 +22,6 @@
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {
@@ -358,10 +358,10 @@ protected:
     HostThread m_read_thread;           ///< The read thread handle in case we need to cancel the thread.
     std::atomic<bool> m_read_thread_enabled;
     std::atomic<bool> m_read_thread_did_exit;
-    std::string m_bytes;    ///< A buffer to cache bytes read in the ReadThread function.
-    Mutex m_bytes_mutex;    ///< A mutex to protect multi-threaded access to the cached bytes.
-    Mutex m_write_mutex;    ///< Don't let multiple threads write at the same time...
-    Mutex m_synchronize_mutex;
+    std::string m_bytes;                ///< A buffer to cache bytes read in the ReadThread function.
+    std::recursive_mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
+    std::mutex m_write_mutex;           ///< Don't let multiple threads write at the same time...
+    std::mutex m_synchronize_mutex;
     ReadThreadBytesReceived m_callback;
     void *m_callback_baton;
     bool m_close_on_eof;

Modified: lldb/trunk/include/lldb/Core/History.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/History.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/History.h (original)
+++ lldb/trunk/include/lldb/Core/History.h Tue May 17 20:59:10 2016
@@ -14,13 +14,13 @@
 #include <stdint.h>
 
 // C++ Includes
+#include <mutex>
 #include <stack>
 #include <string>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -34,11 +34,7 @@ class HistorySource
 public:
     typedef const void * HistoryEvent;
 
-    HistorySource () :
-        m_mutex (Mutex::eMutexTypeRecursive),
-        m_events ()
-    {
-    }
+    HistorySource() : m_mutex(), m_events() {}
 
     virtual 
     ~HistorySource()
@@ -50,20 +46,20 @@ public:
     // onto the end of the history stack.
 
     virtual HistoryEvent
-    CreateHistoryEvent () = 0; 
-    
+    CreateHistoryEvent () = 0;
+
     virtual void
     DeleteHistoryEvent (HistoryEvent event) = 0;
-    
+
     virtual void
     DumpHistoryEvent (Stream &strm, HistoryEvent event) = 0;
 
     virtual size_t
     GetHistoryEventCount() = 0;
-    
+
     virtual HistoryEvent
     GetHistoryEventAtIndex (uint32_t idx) = 0;
-    
+
     virtual HistoryEvent
     GetCurrentHistoryEvent () = 0;
 
@@ -71,16 +67,16 @@ public:
     virtual int
     CompareHistoryEvents (const HistoryEvent lhs, 
                           const HistoryEvent rhs) = 0;
-    
+
     virtual bool
     IsCurrentHistoryEvent (const HistoryEvent event) = 0;
 
 private:
     typedef std::stack<HistoryEvent> collection;
 
-    Mutex m_mutex;
+    std::recursive_mutex m_mutex;
     collection m_events;
-    
+
     DISALLOW_COPY_AND_ASSIGN (HistorySource);
 };
     

Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Tue May 17 20:59:10 2016
@@ -15,6 +15,7 @@
 
 // C++ Includes
 #include <memory>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -709,75 +710,70 @@ namespace lldb_private {
     class IOHandlerStack
     {
     public:
-        IOHandlerStack () :
-            m_stack(),
-            m_mutex(Mutex::eMutexTypeRecursive),
-            m_top (nullptr)
-        {
-        }
-        
+        IOHandlerStack() : m_stack(), m_mutex(), m_top(nullptr) {}
+
         ~IOHandlerStack() = default;
-        
+
         size_t
-        GetSize () const
+        GetSize() const
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             return m_stack.size();
         }
-        
+
         void
-        Push (const lldb::IOHandlerSP& sp)
+        Push(const lldb::IOHandlerSP &sp)
         {
             if (sp)
             {
-                Mutex::Locker locker (m_mutex);
-                sp->SetPopped (false);
-                m_stack.push_back (sp);
+                std::lock_guard<std::recursive_mutex> guard(m_mutex);
+                sp->SetPopped(false);
+                m_stack.push_back(sp);
                 // Set m_top the non-locking IsTop() call
                 m_top = sp.get();
             }
         }
-        
+
         bool
-        IsEmpty () const
+        IsEmpty() const
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             return m_stack.empty();
         }
-        
+
         lldb::IOHandlerSP
-        Top ()
+        Top()
         {
             lldb::IOHandlerSP sp;
             {
-                Mutex::Locker locker (m_mutex);
+                std::lock_guard<std::recursive_mutex> guard(m_mutex);
                 if (!m_stack.empty())
                     sp = m_stack.back();
             }
             return sp;
         }
-        
+
         void
-        Pop ()
+        Pop()
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             if (!m_stack.empty())
             {
-                lldb::IOHandlerSP sp (m_stack.back());
+                lldb::IOHandlerSP sp(m_stack.back());
                 m_stack.pop_back();
-                sp->SetPopped (true);
+                sp->SetPopped(true);
             }
             // Set m_top the non-locking IsTop() call
 
             m_top = (m_stack.empty() ? nullptr : m_stack.back().get());
         }
 
-        Mutex &
+        std::recursive_mutex &
         GetMutex()
         {
             return m_mutex;
         }
-      
+
         bool
         IsTop (const lldb::IOHandlerSP &io_handler_sp) const
         {
@@ -785,13 +781,12 @@ namespace lldb_private {
         }
 
         bool
-        CheckTopIOHandlerTypes (IOHandler::Type top_type, IOHandler::Type second_top_type)
+        CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             const size_t num_io_handlers = m_stack.size();
-            return (num_io_handlers >= 2 &&
-                    m_stack[num_io_handlers-1]->GetType() == top_type &&
-                    m_stack[num_io_handlers-2]->GetType() == second_top_type);
+            return (num_io_handlers >= 2 && m_stack[num_io_handlers - 1]->GetType() == top_type &&
+                    m_stack[num_io_handlers - 2]->GetType() == second_top_type);
         }
 
         ConstString
@@ -818,9 +813,9 @@ namespace lldb_private {
     protected:
         typedef std::vector<lldb::IOHandlerSP> collection;
         collection m_stack;
-        mutable Mutex m_mutex;
+        mutable std::recursive_mutex m_mutex;
         IOHandler *m_top;
-        
+
     private:
         DISALLOW_COPY_AND_ASSIGN (IOHandlerStack);
     };

Modified: lldb/trunk/include/lldb/Core/Listener.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Listener.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Listener.h (original)
+++ lldb/trunk/include/lldb/Core/Listener.h Tue May 17 20:59:10 2016
@@ -14,6 +14,7 @@
 // C++ Includes
 #include <list>
 #include <map>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -175,7 +176,7 @@ private:
 
     std::string m_name;
     broadcaster_collection m_broadcasters;
-    Mutex m_broadcasters_mutex; // Protects m_broadcasters
+    std::recursive_mutex m_broadcasters_mutex; // Protects m_broadcasters
     event_collection m_events;
     Mutex m_events_mutex; // Protects m_broadcasters and m_events
     Condition m_events_condition;

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue May 17 20:59:10 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <atomic>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -22,7 +23,6 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/TimeValue.h"
 #include "lldb/Symbol/SymbolContextScope.h"
 #include "lldb/Symbol/TypeSystem.h"
@@ -68,7 +68,7 @@ public:
     static Module *
     GetAllocatedModuleAtIndex (size_t idx);
 
-    static Mutex *
+    static std::recursive_mutex &
     GetAllocationModuleCollectionMutex();
 
     //------------------------------------------------------------------
@@ -986,8 +986,8 @@ public:
     // SymbolVendor, SymbolFile and ObjectFile member objects should
     // lock the module mutex to avoid deadlocks.
     //------------------------------------------------------------------
-    Mutex &
-    GetMutex () const
+    std::recursive_mutex &
+    GetMutex() const
     {
         return m_mutex;
     }
@@ -1106,7 +1106,7 @@ protected:
     //------------------------------------------------------------------
     // Member Variables
     //------------------------------------------------------------------
-    mutable Mutex               m_mutex;        ///< A mutex to keep this object happy in multi-threaded environments.
+    mutable std::recursive_mutex m_mutex;       ///< A mutex to keep this object happy in multi-threaded environments.
     TimeValue                   m_mod_time;     ///< The modification time for this module when it was created.
     ArchSpec                    m_arch;         ///< The architecture for this module.
     UUID                        m_uuid;         ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.

Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleSpec.h Tue May 17 20:59:10 2016
@@ -12,6 +12,7 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
@@ -20,7 +21,6 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/PathMappingList.h"
 
 namespace lldb_private {
@@ -447,30 +447,24 @@ protected:
 class ModuleSpecList
 {
 public:
-    ModuleSpecList () :
-        m_specs(),
-        m_mutex(Mutex::eMutexTypeRecursive) 
-    {
-    }
+    ModuleSpecList() : m_specs(), m_mutex() {}
 
-    ModuleSpecList (const ModuleSpecList &rhs) :
-        m_specs(),
-        m_mutex(Mutex::eMutexTypeRecursive)
+    ModuleSpecList(const ModuleSpecList &rhs) : m_specs(), m_mutex()
     {
-        Mutex::Locker lhs_locker(m_mutex);
-        Mutex::Locker rhs_locker(rhs.m_mutex);
+        std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
+        std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
         m_specs = rhs.m_specs;
     }
 
     ~ModuleSpecList() = default;
 
     ModuleSpecList &
-    operator = (const ModuleSpecList &rhs)
+    operator=(const ModuleSpecList &rhs)
     {
         if (this != &rhs)
         {
-            Mutex::Locker lhs_locker(m_mutex);
-            Mutex::Locker rhs_locker(rhs.m_mutex);
+            std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
+            std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
             m_specs = rhs.m_specs;
         }
         return *this;
@@ -479,29 +473,29 @@ public:
     size_t
     GetSize() const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_specs.size();
     }
 
     void
-    Clear ()
+    Clear()
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         m_specs.clear();
     }
 
     void
-    Append (const ModuleSpec &spec)
+    Append(const ModuleSpec &spec)
     {
-        Mutex::Locker locker(m_mutex);
-        m_specs.push_back (spec);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+        m_specs.push_back(spec);
     }
 
     void
-    Append (const ModuleSpecList &rhs)
+    Append(const ModuleSpecList &rhs)
     {
-        Mutex::Locker lhs_locker(m_mutex);
-        Mutex::Locker rhs_locker(rhs.m_mutex);
+        std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
+        std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
         m_specs.insert(m_specs.end(), rhs.m_specs.begin(), rhs.m_specs.end());
     }
 
@@ -514,9 +508,9 @@ public:
     }
 
     bool
-    GetModuleSpecAtIndex (size_t i, ModuleSpec &module_spec) const
+    GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         if (i < m_specs.size())
         {
             module_spec = m_specs[i];
@@ -527,11 +521,11 @@ public:
     }
 
     bool
-    FindMatchingModuleSpec (const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
+    FindMatchingModuleSpec(const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         bool exact_arch_match = true;
-        for (auto spec: m_specs)
+        for (auto spec : m_specs)
         {
             if (spec.Matches(module_spec, exact_arch_match))
             {
@@ -539,12 +533,12 @@ public:
                 return true;
             }
         }
-        
+
         // If there was an architecture, retry with a compatible arch
         if (module_spec.GetArchitecturePtr())
         {
             exact_arch_match = false;
-            for (auto spec: m_specs)
+            for (auto spec : m_specs)
             {
                 if (spec.Matches(module_spec, exact_arch_match))
                 {
@@ -556,41 +550,41 @@ public:
         match_module_spec.Clear();
         return false;
     }
-    
+
     size_t
-    FindMatchingModuleSpecs (const ModuleSpec &module_spec, ModuleSpecList &matching_list) const
+    FindMatchingModuleSpecs(const ModuleSpec &module_spec, ModuleSpecList &matching_list) const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         bool exact_arch_match = true;
         const size_t initial_match_count = matching_list.GetSize();
-        for (auto spec: m_specs)
+        for (auto spec : m_specs)
         {
             if (spec.Matches(module_spec, exact_arch_match))
-                matching_list.Append (spec);
+                matching_list.Append(spec);
         }
-        
+
         // If there was an architecture, retry with a compatible arch if no matches were found
         if (module_spec.GetArchitecturePtr() && (initial_match_count == matching_list.GetSize()))
         {
             exact_arch_match = false;
-            for (auto spec: m_specs)
+            for (auto spec : m_specs)
             {
                 if (spec.Matches(module_spec, exact_arch_match))
-                    matching_list.Append (spec);
+                    matching_list.Append(spec);
             }
         }
         return matching_list.GetSize() - initial_match_count;
     }
 
     void
-    Dump (Stream &strm)
+    Dump(Stream &strm)
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         uint32_t idx = 0;
-        for (auto spec: m_specs)
+        for (auto spec : m_specs)
         {
             strm.Printf("[%u] ", idx);
-            spec.Dump (strm);
+            spec.Dump(strm);
             strm.EOL();
             ++idx;
         }
@@ -599,7 +593,7 @@ public:
 protected:
     typedef std::vector<ModuleSpec> collection; ///< The module collection type.
     collection m_specs; ///< The collection of modules.
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Core/StreamCallback.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StreamCallback.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/StreamCallback.h (original)
+++ lldb/trunk/include/lldb/Core/StreamCallback.h Tue May 17 20:59:10 2016
@@ -10,11 +10,11 @@
 #ifndef liblldb_StreamCallback_h_
 #define liblldb_StreamCallback_h_
 
+#include <mutex>
 #include <string>
 
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamString.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -37,8 +37,8 @@ private:
     lldb::LogOutputCallback m_callback;
     void *m_baton;
     collection m_accumulated_data;
-    Mutex m_collection_mutex;
-    
+    std::mutex m_collection_mutex;
+
     StreamString &FindStreamForThread(lldb::tid_t cur_tid);
 };
 

Modified: lldb/trunk/include/lldb/Core/StreamTee.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StreamTee.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/StreamTee.h (original)
+++ lldb/trunk/include/lldb/Core/StreamTee.h Tue May 17 20:59:10 2016
@@ -12,50 +12,37 @@
 
 #include <limits.h>
 
+#include <mutex>
+
 #include "lldb/Core/Stream.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
 class StreamTee : public Stream
 {
 public:
-    StreamTee () :
-        Stream (),
-        m_streams_mutex (Mutex::eMutexTypeRecursive),
-        m_streams ()
-    {
-    }
+    StreamTee() : Stream(), m_streams_mutex(), m_streams() {}
 
-    StreamTee (lldb::StreamSP &stream_sp):
-        Stream (),
-        m_streams_mutex (Mutex::eMutexTypeRecursive),
-        m_streams ()
+    StreamTee(lldb::StreamSP &stream_sp) : Stream(), m_streams_mutex(), m_streams()
     {
         // No need to lock mutex during construction
         if (stream_sp)
-            m_streams.push_back (stream_sp);
+            m_streams.push_back(stream_sp);
     }
-    
 
-    StreamTee (lldb::StreamSP &stream_sp, lldb::StreamSP &stream_2_sp) :
-        Stream (),
-        m_streams_mutex (Mutex::eMutexTypeRecursive),
-        m_streams ()
+    StreamTee(lldb::StreamSP &stream_sp, lldb::StreamSP &stream_2_sp) : Stream(), m_streams_mutex(), m_streams()
     {
         // No need to lock mutex during construction
         if (stream_sp)
-            m_streams.push_back (stream_sp);
+            m_streams.push_back(stream_sp);
         if (stream_2_sp)
-            m_streams.push_back (stream_2_sp);
+            m_streams.push_back(stream_2_sp);
     }
-    
-    StreamTee (const StreamTee &rhs) :
-        Stream (rhs),
-        m_streams_mutex (Mutex::eMutexTypeRecursive),
-        m_streams() // Don't copy until we lock down "rhs"
+
+    StreamTee(const StreamTee &rhs) : Stream(rhs), m_streams_mutex(), m_streams()
     {
-        Mutex::Locker locker (rhs.m_streams_mutex);
+        // Don't copy until we lock down "rhs"
+        std::lock_guard<std::recursive_mutex> guard(rhs.m_streams_mutex);
         m_streams = rhs.m_streams;
     }
 
@@ -64,21 +51,22 @@ public:
     }
 
     StreamTee &
-    operator = (const StreamTee &rhs)
+    operator=(const StreamTee &rhs)
     {
-        if (this != &rhs) {
+        if (this != &rhs)
+        {
             Stream::operator=(rhs);
-            Mutex::Locker lhs_locker (m_streams_mutex);
-            Mutex::Locker rhs_locker (rhs.m_streams_mutex);
-            m_streams = rhs.m_streams;            
+            std::lock_guard<std::recursive_mutex> lhs_locker(m_streams_mutex);
+            std::lock_guard<std::recursive_mutex> rhs_locker(rhs.m_streams_mutex);
+            m_streams = rhs.m_streams;
         }
         return *this;
     }
 
     void
-    Flush () override
+    Flush() override
     {
-        Mutex::Locker locker (m_streams_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
         collection::iterator pos, end;
         for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos)
         {
@@ -88,17 +76,17 @@ public:
             // to valid values.
             Stream *strm = pos->get();
             if (strm)
-                strm->Flush ();
+                strm->Flush();
         }
     }
 
     size_t
-    Write (const void *s, size_t length) override
+    Write(const void *s, size_t length) override
     {
-        Mutex::Locker locker (m_streams_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
         if (m_streams.empty())
             return 0;
-    
+
         size_t min_bytes_written = SIZE_MAX;
         collection::iterator pos, end;
         for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos)
@@ -110,7 +98,7 @@ public:
             Stream *strm = pos->get();
             if (strm)
             {
-                const size_t bytes_written = strm->Write (s, length);
+                const size_t bytes_written = strm->Write(s, length);
                 if (min_bytes_written > bytes_written)
                     min_bytes_written = bytes_written;
             }
@@ -121,39 +109,39 @@ public:
     }
 
     size_t
-    AppendStream (const lldb::StreamSP &stream_sp)
+    AppendStream(const lldb::StreamSP &stream_sp)
     {
         size_t new_idx = m_streams.size();
-        Mutex::Locker locker (m_streams_mutex);
-        m_streams.push_back (stream_sp);
+        std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
+        m_streams.push_back(stream_sp);
         return new_idx;
     }
 
     size_t
-    GetNumStreams () const
+    GetNumStreams() const
     {
         size_t result = 0;
         {
-            Mutex::Locker locker (m_streams_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
             result = m_streams.size();
         }
         return result;
     }
 
     lldb::StreamSP
-    GetStreamAtIndex (uint32_t idx)
+    GetStreamAtIndex(uint32_t idx)
     {
         lldb::StreamSP stream_sp;
-        Mutex::Locker locker (m_streams_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
         if (idx < m_streams.size())
             stream_sp = m_streams[idx];
         return stream_sp;
     }
 
     void
-    SetStreamAtIndex (uint32_t idx, const lldb::StreamSP& stream_sp)
+    SetStreamAtIndex(uint32_t idx, const lldb::StreamSP &stream_sp)
     {
-        Mutex::Locker locker (m_streams_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_streams_mutex);
         // Resize our stream vector as necessary to fit as many streams
         // as needed. This also allows this class to be used with hard
         // coded indexes that can be used contain many streams, not all
@@ -162,10 +150,10 @@ public:
             m_streams.resize(idx + 1);
         m_streams[idx] = stream_sp;
     }
-    
+
 protected:
     typedef std::vector<lldb::StreamSP> collection;
-    mutable Mutex m_streams_mutex;
+    mutable std::recursive_mutex m_streams_mutex;
     collection m_streams;
 };
 

Modified: lldb/trunk/include/lldb/Core/ThreadSafeSTLMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeSTLMap.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ThreadSafeSTLMap.h (original)
+++ lldb/trunk/include/lldb/Core/ThreadSafeSTLMap.h Tue May 17 20:59:10 2016
@@ -13,11 +13,11 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-defines.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -31,11 +31,7 @@ public:
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    ThreadSafeSTLMap() :
-        m_collection (),
-        m_mutex (Mutex::eMutexTypeRecursive)
-    {
-    }
+    ThreadSafeSTLMap() : m_collection(), m_mutex() {}
 
     ~ThreadSafeSTLMap()
     {
@@ -44,22 +40,22 @@ public:
     bool
     IsEmpty() const
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_collection.empty();
     }
-    
+
     void
     Clear()
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         return m_collection.clear();
     }
 
     size_t
-    Erase (const _Key& key)
+    Erase(const _Key &key)
     {
-        Mutex::Locker locker(m_mutex);
-        return EraseNoLock (key);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+        return EraseNoLock(key);
     }
 
     size_t
@@ -69,10 +65,10 @@ public:
     }
 
     bool
-    GetValueForKey (const _Key& key, _Tp &value) const
+    GetValueForKey(const _Key &key, _Tp &value) const
     {
-        Mutex::Locker locker(m_mutex);
-        return GetValueForKeyNoLock (key, value);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+        return GetValueForKeyNoLock(key, value);
     }
 
     // Call this if you have already manually locked the mutex using the
@@ -90,10 +86,10 @@ public:
     }
 
     bool
-    GetFirstKeyForValue (const _Tp &value, _Key& key) const
+    GetFirstKeyForValue(const _Tp &value, _Key &key) const
     {
-        Mutex::Locker locker(m_mutex);
-        return GetFirstKeyForValueNoLock (value, key);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+        return GetFirstKeyForValueNoLock(value, key);
     }
 
     bool
@@ -112,13 +108,10 @@ public:
     }
 
     bool
-    LowerBound (const _Key& key,
-                _Key& match_key,
-                _Tp &match_value,
-                bool decrement_if_not_equal) const
+    LowerBound(const _Key &key, _Key &match_key, _Tp &match_value, bool decrement_if_not_equal) const
     {
-        Mutex::Locker locker(m_mutex);
-        return LowerBoundNoLock (key, match_key, match_value, decrement_if_not_equal);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+        return LowerBoundNoLock(key, match_key, match_value, decrement_if_not_equal);
     }
 
     bool
@@ -149,10 +142,10 @@ public:
     }
 
     void
-    SetValueForKey (const _Key& key, const _Tp &value)
+    SetValueForKey(const _Key &key, const _Tp &value)
     {
-        Mutex::Locker locker(m_mutex);
-        SetValueForKeyNoLock (key, value);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+        SetValueForKeyNoLock(key, value);
     }
 
     // Call this if you have already manually locked the mutex using the
@@ -163,15 +156,15 @@ public:
         m_collection[key] = value;
     }
 
-    Mutex &
-    GetMutex ()
+    std::recursive_mutex &
+    GetMutex()
     {
         return m_mutex;
     }
 
 private:
     collection m_collection;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 
     //------------------------------------------------------------------
     // For ThreadSafeSTLMap only

Modified: lldb/trunk/include/lldb/Core/ThreadSafeValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeValue.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ThreadSafeValue.h (original)
+++ lldb/trunk/include/lldb/Core/ThreadSafeValue.h Tue May 17 20:59:10 2016
@@ -11,10 +11,12 @@
 #define liblldb_ThreadSafeValue_h_
 
 // C Includes
+
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -25,28 +27,20 @@ public:
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    ThreadSafeValue() :
-        m_value (),
-        m_mutex (Mutex::eMutexTypeRecursive)
-    {
-    }
+    ThreadSafeValue() : m_value(), m_mutex() {}
 
-    ThreadSafeValue(const T& value) :
-        m_value (value),
-        m_mutex (Mutex::eMutexTypeRecursive)
-    {
-    }
+    ThreadSafeValue(const T &value) : m_value(value), m_mutex() {}
 
     ~ThreadSafeValue()
     {
     }
 
     T
-    GetValue () const
+    GetValue() const
     {
         T value;
         {
-            Mutex::Locker locker(m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             value = m_value;
         }
         return value;
@@ -61,9 +55,9 @@ public:
     }
 
     void
-    SetValue (const T& value)
+    SetValue(const T &value)
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         m_value = value;
     }
 
@@ -75,15 +69,15 @@ public:
         m_value = value;
     }
 
-    Mutex &
-    GetMutex ()
+    std::recursive_mutex &
+    GetMutex()
     {
         return m_mutex;
     }
 
 private:
     T m_value;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 
     //------------------------------------------------------------------
     // For ThreadSafeValue only

Modified: lldb/trunk/include/lldb/Core/UserSettingsController.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/UserSettingsController.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/UserSettingsController.h (original)
+++ lldb/trunk/include/lldb/Core/UserSettingsController.h Tue May 17 20:59:10 2016
@@ -24,7 +24,6 @@
 #include "lldb/Core/StringList.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamString.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Interpreter/OptionValue.h"
 
 namespace lldb_private {

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue May 17 20:59:10 2016
@@ -1034,35 +1034,32 @@ protected:
     class ChildrenManager
     {
     public:
-        ChildrenManager() :
-            m_mutex(Mutex::eMutexTypeRecursive),
-            m_children(),
-            m_children_count(0)
-        {}
-        
+        ChildrenManager() : m_mutex(), m_children(), m_children_count(0) {}
+
         bool
-        HasChildAtIndex (size_t idx)
+        HasChildAtIndex(size_t idx)
         {
-            Mutex::Locker locker(m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             return (m_children.find(idx) != m_children.end());
         }
-        
-        ValueObject*
-        GetChildAtIndex (size_t idx)
+
+        ValueObject *
+        GetChildAtIndex(size_t idx)
         {
-            Mutex::Locker locker(m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             const auto iter = m_children.find(idx);
             return ((iter == m_children.end()) ? nullptr : iter->second);
         }
-        
+
         void
-        SetChildAtIndex (size_t idx, ValueObject* valobj)
+        SetChildAtIndex(size_t idx, ValueObject *valobj)
         {
-            ChildrenPair pair(idx,valobj); // we do not need to be mutex-protected to make a pair
-            Mutex::Locker locker(m_mutex);
+            // we do not need to be mutex-protected to make a pair
+            ChildrenPair pair(idx, valobj);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             m_children.insert(pair);
         }
-        
+
         void
         SetChildrenCount (size_t count)
         {
@@ -1074,20 +1071,20 @@ protected:
         {
             return m_children_count;
         }
-        
+
         void
         Clear(size_t new_count = 0)
         {
-            Mutex::Locker locker(m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             m_children_count = new_count;
             m_children.clear();
         }
-        
+
     private:
         typedef std::map<size_t, ValueObject*> ChildrenMap;
         typedef ChildrenMap::iterator ChildrenIterator;
         typedef ChildrenMap::value_type ChildrenPair;
-        Mutex m_mutex;
+        std::recursive_mutex m_mutex;
         ChildrenMap m_children;
         size_t m_children_count;
     };

Modified: lldb/trunk/include/lldb/DataFormatters/FormatCache.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatCache.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormatCache.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatCache.h Tue May 17 20:59:10 2016
@@ -13,12 +13,12 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Core/ConstString.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 class FormatCache
@@ -82,8 +82,8 @@ private:
     };
     typedef std::map<ConstString,Entry> CacheMap;
     CacheMap m_map;
-    Mutex m_mutex;
-    
+    std::recursive_mutex m_mutex;
+
     uint64_t m_cache_hits;
     uint64_t m_cache_misses;
     

Modified: lldb/trunk/include/lldb/DataFormatters/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatManager.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormatManager.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatManager.h Tue May 17 20:59:10 2016
@@ -15,6 +15,7 @@
 #include <atomic>
 #include <initializer_list>
 #include <map>
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
@@ -289,7 +290,7 @@ private:
 
     std::atomic<uint32_t> m_last_revision;
     FormatCache m_format_cache;
-    Mutex m_language_categories_mutex;
+    std::recursive_mutex m_language_categories_mutex;
     LanguageCategories m_language_categories_map;
     NamedSummariesMap m_named_summaries_map;
     TypeCategoryMap m_categories_map;

Modified: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h Tue May 17 20:59:10 2016
@@ -15,6 +15,7 @@
 #include <functional>
 #include <map>
 #include <memory>
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
@@ -81,33 +82,27 @@ public:
     typedef std::map<KeyType, ValueSP> MapType;
     typedef typename MapType::iterator MapIterator;
     typedef std::function<bool(KeyType, const ValueSP&)> ForEachCallback;
-    
-    FormatMap(IFormatChangeListener* lst) :
-    m_map(),
-    m_map_mutex(Mutex::eMutexTypeRecursive),
-    listener(lst)
-    {
-    }
-    
+
+    FormatMap(IFormatChangeListener *lst) : m_map(), m_map_mutex(), listener(lst) {}
+
     void
-    Add(KeyType name,
-        const ValueSP& entry)
+    Add(KeyType name, const ValueSP &entry)
     {
         if (listener)
             entry->GetRevision() = listener->GetCurrentRevision();
         else
             entry->GetRevision() = 0;
 
-        Mutex::Locker locker(m_map_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
         m_map[name] = entry;
         if (listener)
             listener->Changed();
     }
-    
+
     bool
-    Delete (KeyType name)
+    Delete(KeyType name)
     {
-        Mutex::Locker locker(m_map_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
         MapIterator iter = m_map.find(name);
         if (iter == m_map.end())
             return false;
@@ -116,34 +111,33 @@ public:
             listener->Changed();
         return true;
     }
-    
+
     void
-    Clear ()
+    Clear()
     {
-        Mutex::Locker locker(m_map_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
         m_map.clear();
         if (listener)
             listener->Changed();
     }
-    
+
     bool
-    Get(KeyType name,
-        ValueSP& entry)
+    Get(KeyType name, ValueSP &entry)
     {
-        Mutex::Locker locker(m_map_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
         MapIterator iter = m_map.find(name);
         if (iter == m_map.end())
             return false;
         entry = iter->second;
         return true;
     }
-    
+
     void
-    ForEach (ForEachCallback callback)
+    ForEach(ForEachCallback callback)
     {
         if (callback)
         {
-            Mutex::Locker locker(m_map_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
             MapIterator pos, end = m_map.end();
             for (pos = m_map.begin(); pos != end; pos++)
             {
@@ -153,17 +147,17 @@ public:
             }
         }
     }
-    
+
     uint32_t
     GetCount ()
     {
         return m_map.size();
     }
-    
+
     ValueSP
-    GetValueAtIndex (size_t index)
+    GetValueAtIndex(size_t index)
     {
-        Mutex::Locker locker(m_map_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
         MapIterator iter = m_map.begin();
         MapIterator end = m_map.end();
         while (index > 0)
@@ -175,11 +169,11 @@ public:
         }
         return iter->second;
     }
-    
+
     KeyType
-    GetKeyAtIndex (size_t index)
+    GetKeyAtIndex(size_t index)
     {
-        Mutex::Locker locker(m_map_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
         MapIterator iter = m_map.begin();
         MapIterator end = m_map.end();
         while (index > 0)
@@ -191,24 +185,24 @@ public:
         }
         return iter->first;
     }
-    
+
 protected:
-    MapType m_map;    
-    Mutex m_map_mutex;
+    MapType m_map;
+    std::recursive_mutex m_map_mutex;
     IFormatChangeListener* listener;
-    
+
     MapType&
     map ()
     {
         return m_map;
     }
-    
-    Mutex&
-    mutex ()
+
+    std::recursive_mutex &
+    mutex()
     {
         return m_map_mutex;
     }
-    
+
     friend class FormattersContainer<KeyType, ValueType>;
     friend class FormatManager;
 };
@@ -332,24 +326,23 @@ protected:
     }
 
     bool
-    Delete_Impl (ConstString type, lldb::RegularExpressionSP *dummy)
+    Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy)
     {
-       Mutex& x_mutex = m_format_map.mutex();
-        lldb_private::Mutex::Locker locker(x_mutex);
-       MapIterator pos, end = m_format_map.map().end();
-       for (pos = m_format_map.map().begin(); pos != end; pos++)
-       {
-           lldb::RegularExpressionSP regex = pos->first;
-           if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
-           {
-               m_format_map.map().erase(pos);
-               if (m_format_map.listener)
-                   m_format_map.listener->Changed();
-               return true;
-           }
-       }
-       return false;
-    }    
+        std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+        MapIterator pos, end = m_format_map.map().end();
+        for (pos = m_format_map.map().begin(); pos != end; pos++)
+        {
+            lldb::RegularExpressionSP regex = pos->first;
+            if (::strcmp(type.AsCString(), regex->GetText()) == 0)
+            {
+                m_format_map.map().erase(pos);
+                if (m_format_map.listener)
+                    m_format_map.listener->Changed();
+                return true;
+            }
+        }
+        return false;
+    }
 
     bool
     Get_Impl (ConstString type, MapValueType& entry, ConstString *dummy)
@@ -385,36 +378,34 @@ protected:
     }
 
     bool
-    Get_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy)
+    Get_Impl(ConstString key, MapValueType &value, lldb::RegularExpressionSP *dummy)
     {
-       const char* key_cstr = key.AsCString();
-       if (!key_cstr)
-           return false;
-       Mutex& x_mutex = m_format_map.mutex();
-       lldb_private::Mutex::Locker locker(x_mutex);
-       MapIterator pos, end = m_format_map.map().end();
-       for (pos = m_format_map.map().begin(); pos != end; pos++)
-       {
-           lldb::RegularExpressionSP regex = pos->first;
-           if (regex->Execute(key_cstr))
-           {
-               value = pos->second;
-               return true;
-           }
-       }
-       return false;
+        const char *key_cstr = key.AsCString();
+        if (!key_cstr)
+            return false;
+        std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+        MapIterator pos, end = m_format_map.map().end();
+        for (pos = m_format_map.map().begin(); pos != end; pos++)
+        {
+            lldb::RegularExpressionSP regex = pos->first;
+            if (regex->Execute(key_cstr))
+            {
+                value = pos->second;
+                return true;
+            }
+        }
+        return false;
     }
-    
+
     bool
-    GetExact_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy)
+    GetExact_Impl(ConstString key, MapValueType &value, lldb::RegularExpressionSP *dummy)
     {
-        Mutex& x_mutex = m_format_map.mutex();
-        lldb_private::Mutex::Locker locker(x_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
         MapIterator pos, end = m_format_map.map().end();
         for (pos = m_format_map.map().begin(); pos != end; pos++)
         {
             lldb::RegularExpressionSP regex = pos->first;
-            if (strcmp(regex->GetText(),key.AsCString()) == 0)
+            if (strcmp(regex->GetText(), key.AsCString()) == 0)
             {
                 value = pos->second;
                 return true;

Modified: lldb/trunk/include/lldb/DataFormatters/TypeCategory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeCategory.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeCategory.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeCategory.h Tue May 17 20:59:10 2016
@@ -14,6 +14,7 @@
 // C++ Includes
 #include <initializer_list>
 #include <memory>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -519,9 +520,9 @@ namespace lldb_private {
         bool m_enabled;
         
         IFormatChangeListener* m_change_listener;
-        
-        Mutex m_mutex;
-        
+
+        std::recursive_mutex m_mutex;
+
         ConstString m_name;
         
         std::vector<lldb::LanguageType> m_languages;

Modified: lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeCategoryMap.h Tue May 17 20:59:10 2016
@@ -15,6 +15,7 @@
 #include <functional>
 #include <list>
 #include <map>
+#include <mutex>
 
 // Other libraries and framework includes
 // Project includes
@@ -131,8 +132,8 @@ namespace lldb_private {
                 return ptr.get() == other.get();
             }
         };
-        
-        Mutex m_map_mutex;
+
+        std::recursive_mutex m_map_mutex;
         IFormatChangeListener* listener;
         
         MapType m_map;
@@ -147,12 +148,13 @@ namespace lldb_private {
         {
             return m_active_categories;
         }
-        
-        Mutex& mutex ()
+
+        std::recursive_mutex &
+        mutex()
         {
             return m_map_mutex;
         }
-        
+
         friend class FormattersContainer<KeyType, ValueType>;
         friend class FormatManager;
     };

Modified: lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRExecutionUnit.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRExecutionUnit.h (original)
+++ lldb/trunk/include/lldb/Expression/IRExecutionUnit.h Tue May 17 20:59:10 2016
@@ -26,7 +26,6 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Expression/IRMemoryMap.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
 

Modified: lldb/trunk/include/lldb/Host/Editline.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Editline.h (original)
+++ lldb/trunk/include/lldb/Host/Editline.h Tue May 17 20:59:10 2016
@@ -50,13 +50,13 @@
 #endif
 #endif
 
+#include <mutex>
 #include <string>
 #include <vector>
 
 #include "lldb/Host/Condition.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/Predicate.h"
 
 namespace lldb_private {
@@ -359,7 +359,7 @@ namespace lldb_private {
         CompleteCallbackType m_completion_callback = nullptr;
         void * m_completion_callback_baton = nullptr;
 
-        Mutex m_output_mutex;
+        std::mutex m_output_mutex;
     };
 }
 

Modified: lldb/trunk/include/lldb/Host/ProcessRunLock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ProcessRunLock.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/ProcessRunLock.h (original)
+++ lldb/trunk/include/lldb/Host/ProcessRunLock.h Tue May 17 20:59:10 2016
@@ -18,7 +18,6 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-defines.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/Condition.h"
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h Tue May 17 20:59:10 2016
@@ -12,11 +12,11 @@
 
 #include "lldb/lldb-private-forward.h"
 #include "lldb/Core/Error.h"
-#include "lldb/Host/Mutex.h"
 // #include "lldb/Host/NativeBreakpoint.h"
 
 #include <functional>
 #include <map>
+#include <mutex>
 
 namespace lldb_private
 {
@@ -48,7 +48,7 @@ namespace lldb_private
     private:
         typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
 
-        Mutex m_mutex;
+        std::recursive_mutex m_mutex;
         BreakpointMap m_breakpoints;
     };
 }

Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Tue May 17 20:59:10 2016
@@ -10,12 +10,12 @@
 #ifndef liblldb_NativeProcessProtocol_h_
 #define liblldb_NativeProcessProtocol_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/lldb-private-forward.h"
 #include "lldb/lldb-types.h"
 #include "lldb/Core/Error.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/MainLoop.h"
 #include "llvm/ADT/StringRef.h"
 
@@ -364,15 +364,15 @@ namespace lldb_private
 
         std::vector<NativeThreadProtocolSP> m_threads;
         lldb::tid_t m_current_thread_id;
-        mutable Mutex m_threads_mutex;
+        mutable std::recursive_mutex m_threads_mutex;
 
         lldb::StateType m_state;
-        mutable Mutex m_state_mutex;
+        mutable std::recursive_mutex m_state_mutex;
 
         lldb_private::ExitType m_exit_type;
         int m_exit_status;
         std::string m_exit_description;
-        Mutex m_delegates_mutex;
+        std::recursive_mutex m_delegates_mutex;
         std::vector<NativeDelegate*> m_delegates;
         NativeBreakpointList m_breakpoint_list;
         NativeWatchpointList m_watchpoint_list;

Modified: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h Tue May 17 20:59:10 2016
@@ -13,13 +13,13 @@
 // C++ Includes
 #include <atomic>
 #include <memory>
+#include <mutex>
 
 #include "lldb/lldb-forward.h"
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Connection.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/IOObject.h"
@@ -105,7 +105,7 @@ class ConnectionFileDescriptor : public
                                           // the port number.
 
     Pipe m_pipe;
-    Mutex m_mutex;
+    std::recursive_mutex m_mutex;
     std::atomic<bool> m_shutting_down; // This marks that we are shutting down so if we get woken up from
                                        // BytesAvailable to disconnect, we won't try to read again.
     bool m_waiting_for_accept;

Modified: lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h (original)
+++ lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h Tue May 17 20:59:10 2016
@@ -11,9 +11,9 @@
 #define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
 
 #include "lldb/lldb-private-types.h"
-#include "lldb/Host/Mutex.h"
 
 #include <memory>
+#include <mutex>
 
 namespace lldb_private
 {
@@ -29,13 +29,14 @@ class SystemLifetimeManager
     void Terminate();
 
   private:
-    Mutex m_mutex;
-    std::unique_ptr<SystemInitializer> m_initializer;
-    bool m_initialized;
-
-    // Noncopyable.
-    SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
-    SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
+      std::recursive_mutex m_mutex;
+      std::unique_ptr<SystemInitializer> m_initializer;
+      bool m_initialized;
+
+      // Noncopyable.
+      SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
+      SystemLifetimeManager &
+      operator=(const SystemLifetimeManager &other) = delete;
 };
 }
 

Modified: lldb/trunk/include/lldb/Interpreter/CommandHistory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandHistory.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandHistory.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandHistory.h Tue May 17 20:59:10 2016
@@ -12,6 +12,7 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -19,7 +20,6 @@
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Stream.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
     
@@ -66,7 +66,7 @@ private:
     DISALLOW_COPY_AND_ASSIGN(CommandHistory);
     
     typedef std::vector<std::string> History;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
     History m_history;
 };
 

Modified: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h Tue May 17 20:59:10 2016
@@ -14,7 +14,6 @@
 
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/RangeMap.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/lldb-private.h"
 

Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original)
+++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Tue May 17 20:59:10 2016
@@ -1,12 +1,12 @@
 #ifndef liblldb_FuncUnwinders_h
 #define liblldb_FuncUnwinders_h
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/Core/AddressRange.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/AddressRange.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -119,7 +119,7 @@ private:
     UnwindTable& m_unwind_table;
     AddressRange m_range;
 
-    Mutex m_mutex;
+    std::recursive_mutex m_mutex;
 
     lldb::UnwindPlanSP              m_unwind_plan_assembly_sp;
     lldb::UnwindPlanSP              m_unwind_plan_eh_frame_sp;

Modified: lldb/trunk/include/lldb/Target/JITLoaderList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/JITLoaderList.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/JITLoaderList.h (original)
+++ lldb/trunk/include/lldb/Target/JITLoaderList.h Tue May 17 20:59:10 2016
@@ -10,10 +10,10 @@
 #ifndef liblldb_JITLoaderList_h_
 #define liblldb_JITLoaderList_h_
 
+#include <mutex>
 #include <vector>
 
 #include "lldb/lldb-forward.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -52,7 +52,7 @@ public:
 
 private:
     std::vector<lldb::JITLoaderSP> m_jit_loaders_vec;
-    lldb_private::Mutex m_jit_loaders_mutex;
+    std::recursive_mutex m_jit_loaders_mutex;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Tue May 17 20:59:10 2016
@@ -15,6 +15,7 @@
 #include <functional>
 #include <map>
 #include <memory>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -28,7 +29,6 @@
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Mutex.h"
 
 // TODO pull NativeDelegate class out of NativeProcessProtocol so we
 // can just forward ref the NativeDelegate rather than include it here.
@@ -1079,7 +1079,8 @@ class ModuleCache;
         uint32_t m_update_os_version;
         ArchSpec m_system_arch; // The architecture of the kernel or the remote platform
         typedef std::map<uint32_t, ConstString> IDToNameMap;
-        Mutex m_mutex; // Mutex for modifying Platform data structures that should only be used for non-reentrant code
+        // Mutex for modifying Platform data structures that should only be used for non-reentrant code
+        std::mutex m_mutex;
         IDToNameMap m_uid_map;
         IDToNameMap m_gid_map;
         size_t m_max_uid_name_len;
@@ -1112,9 +1113,9 @@ class ModuleCache;
         CalculateTrapHandlerSymbolNames () = 0;
 
         const char *
-        GetCachedUserName (uint32_t uid)
+        GetCachedUserName(uint32_t uid)
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             // return the empty string if our string is NULL
             // so we can tell when things were in the negative
             // cached (didn't find a valid user name, don't keep
@@ -1124,35 +1125,35 @@ class ModuleCache;
         }
 
         const char *
-        SetCachedUserName (uint32_t uid, const char *name, size_t name_len)
+        SetCachedUserName(uint32_t uid, const char *name, size_t name_len)
         {
-            Mutex::Locker locker (m_mutex);
-            ConstString const_name (name);
+            std::lock_guard<std::mutex> guard(m_mutex);
+            ConstString const_name(name);
             m_uid_map[uid] = const_name;
             if (m_max_uid_name_len < name_len)
                 m_max_uid_name_len = name_len;
             // Const strings lives forever in our const string pool, so we can return the const char *
-            return const_name.GetCString(); 
+            return const_name.GetCString();
         }
 
         void
-        SetUserNameNotFound (uint32_t uid)
+        SetUserNameNotFound(uint32_t uid)
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             m_uid_map[uid] = ConstString();
         }
 
         void
-        ClearCachedUserNames ()
+        ClearCachedUserNames()
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             m_uid_map.clear();
         }
-    
+
         const char *
-        GetCachedGroupName (uint32_t gid)
+        GetCachedGroupName(uint32_t gid)
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             // return the empty string if our string is NULL
             // so we can tell when things were in the negative
             // cached (didn't find a valid group name, don't keep
@@ -1162,28 +1163,28 @@ class ModuleCache;
         }
 
         const char *
-        SetCachedGroupName (uint32_t gid, const char *name, size_t name_len)
+        SetCachedGroupName(uint32_t gid, const char *name, size_t name_len)
         {
-            Mutex::Locker locker (m_mutex);
-            ConstString const_name (name);
+            std::lock_guard<std::mutex> guard(m_mutex);
+            ConstString const_name(name);
             m_gid_map[gid] = const_name;
             if (m_max_gid_name_len < name_len)
                 m_max_gid_name_len = name_len;
             // Const strings lives forever in our const string pool, so we can return the const char *
-            return const_name.GetCString(); 
+            return const_name.GetCString();
         }
 
         void
-        SetGroupNameNotFound (uint32_t gid)
+        SetGroupNameNotFound(uint32_t gid)
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             m_gid_map[gid] = ConstString();
         }
 
         void
-        ClearCachedGroupNames ()
+        ClearCachedGroupNames()
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             m_gid_map.clear();
         }
 
@@ -1236,20 +1237,15 @@ class ModuleCache;
     class PlatformList
     {
     public:
-        PlatformList() :
-            m_mutex (Mutex::eMutexTypeRecursive),
-            m_platforms (),
-            m_selected_platform_sp()
-        {
-        }
+        PlatformList() : m_mutex(), m_platforms(), m_selected_platform_sp() {}
 
         ~PlatformList() = default;
 
         void
-        Append (const lldb::PlatformSP &platform_sp, bool set_selected)
+        Append(const lldb::PlatformSP &platform_sp, bool set_selected)
         {
-            Mutex::Locker locker (m_mutex);
-            m_platforms.push_back (platform_sp);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
+            m_platforms.push_back(platform_sp);
             if (set_selected)
                 m_selected_platform_sp = m_platforms.back();
         }
@@ -1257,16 +1253,16 @@ class ModuleCache;
         size_t
         GetSize()
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             return m_platforms.size();
         }
 
         lldb::PlatformSP
-        GetAtIndex (uint32_t idx)
+        GetAtIndex(uint32_t idx)
         {
             lldb::PlatformSP platform_sp;
             {
-                Mutex::Locker locker (m_mutex);
+                std::lock_guard<std::recursive_mutex> guard(m_mutex);
                 if (idx < m_platforms.size())
                     platform_sp = m_platforms[idx];
             }
@@ -1283,23 +1279,23 @@ class ModuleCache;
         /// processes.
         //------------------------------------------------------------------
         lldb::PlatformSP
-        GetSelectedPlatform ()
+        GetSelectedPlatform()
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_mutex);
             if (!m_selected_platform_sp && !m_platforms.empty())
                 m_selected_platform_sp = m_platforms.front();
-            
+
             return m_selected_platform_sp;
         }
 
         void
-        SetSelectedPlatform (const lldb::PlatformSP &platform_sp)
+        SetSelectedPlatform(const lldb::PlatformSP &platform_sp)
         {
             if (platform_sp)
             {
-                Mutex::Locker locker (m_mutex);
+                std::lock_guard<std::recursive_mutex> guard(m_mutex);
                 const size_t num_platforms = m_platforms.size();
-                for (size_t idx=0; idx<num_platforms; ++idx)
+                for (size_t idx = 0; idx < num_platforms; ++idx)
                 {
                     if (m_platforms[idx].get() == platform_sp.get())
                     {
@@ -1307,21 +1303,21 @@ class ModuleCache;
                         return;
                     }
                 }
-                m_platforms.push_back (platform_sp);
+                m_platforms.push_back(platform_sp);
                 m_selected_platform_sp = m_platforms.back();
             }
         }
 
     protected:
         typedef std::vector<lldb::PlatformSP> collection;
-        mutable Mutex m_mutex;
+        mutable std::recursive_mutex m_mutex;
         collection m_platforms;
         lldb::PlatformSP m_selected_platform_sp;
 
     private:
         DISALLOW_COPY_AND_ASSIGN (PlatformList);
     };
-    
+
     class OptionGroupPlatformRSync : public lldb_private::OptionGroup
     {
     public:

Modified: lldb/trunk/include/lldb/Target/SectionLoadHistory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/SectionLoadHistory.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/SectionLoadHistory.h (original)
+++ lldb/trunk/include/lldb/Target/SectionLoadHistory.h Tue May 17 20:59:10 2016
@@ -13,10 +13,10 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 
 // Project includes
 #include "lldb/lldb-public.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -31,11 +31,7 @@ public:
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    SectionLoadHistory () :
-        m_stop_id_to_section_load_list(),
-        m_mutex (Mutex::eMutexTypeRecursive)
-    {
-    }
+    SectionLoadHistory() : m_stop_id_to_section_load_list(), m_mutex() {}
 
     ~SectionLoadHistory()
     {
@@ -98,7 +94,7 @@ protected:
 
     typedef std::map<uint32_t, lldb::SectionLoadListSP> StopIDToSectionLoadList;
     StopIDToSectionLoadList m_stop_id_to_section_load_list;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 
 private:
     DISALLOW_COPY_AND_ASSIGN (SectionLoadHistory);

Modified: lldb/trunk/include/lldb/Target/SectionLoadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/SectionLoadList.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/SectionLoadList.h (original)
+++ lldb/trunk/include/lldb/Target/SectionLoadList.h Tue May 17 20:59:10 2016
@@ -13,13 +13,13 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 
 // Other libraries and framework includes
 #include "llvm/ADT/DenseMap.h"
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Core/Section.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -29,13 +29,7 @@ public:
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    SectionLoadList () :
-        m_addr_to_sect (),
-        m_sect_to_addr (),
-        m_mutex (Mutex::eMutexTypeRecursive)
-
-    {
-    }
+    SectionLoadList() : m_addr_to_sect(), m_sect_to_addr(), m_mutex() {}
 
     SectionLoadList (const SectionLoadList& rhs);
 
@@ -84,7 +78,7 @@ protected:
     typedef llvm::DenseMap<const Section *, lldb::addr_t> sect_to_addr_collection;
     addr_to_sect_collection m_addr_to_sect;
     sect_to_addr_collection m_sect_to_addr;
-    mutable Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/TargetList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/TargetList.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/TargetList.h (original)
+++ lldb/trunk/include/lldb/Target/TargetList.h Tue May 17 20:59:10 2016
@@ -12,12 +12,12 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Broadcaster.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Target.h"
 
 namespace lldb_private {
@@ -229,7 +229,7 @@ protected:
     //------------------------------------------------------------------
     collection m_target_list;
     lldb::TargetSP m_dummy_target_sp;
-    mutable Mutex m_target_list_mutex;
+    mutable std::recursive_mutex m_target_list_mutex;
     uint32_t m_selected_target_idx;
 
 private:

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Tue May 17 20:59:10 2016
@@ -13,13 +13,13 @@
 // C Includes
 // C++ Includes
 #include <memory>
+#include <mutex>
 #include <string>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/StructuredData.h"
@@ -1446,11 +1446,11 @@ protected:
     const uint32_t      m_index_id;             ///< A unique 1 based index assigned to each thread for easy UI/command line access.
     lldb::RegisterContextSP m_reg_context_sp;   ///< The register context for this thread's current register state.
     lldb::StateType     m_state;                ///< The state of our process.
-    mutable Mutex       m_state_mutex;          ///< Multithreaded protection for m_state.
+    mutable std::recursive_mutex m_state_mutex; ///< Multithreaded protection for m_state.
     plan_stack          m_plan_stack;           ///< The stack of plans this thread is executing.
     plan_stack          m_completed_plan_stack; ///< Plans that have been completed by this stop.  They get deleted when the thread resumes.
     plan_stack          m_discarded_plan_stack; ///< Plans that have been discarded by this stop.  They get deleted when the thread resumes.
-    mutable Mutex       m_frame_mutex;          ///< Multithreaded protection for m_state.
+    mutable std::recursive_mutex m_frame_mutex; ///< Multithreaded protection for m_state.
     lldb::StackFrameListSP m_curr_frames_sp;    ///< The stack frames that get lazily populated after a thread stops.
     lldb::StackFrameListSP m_prev_frames_sp;    ///< The previous stack frames from the last time this thread stopped.
     int                 m_resume_signal;        ///< The signal that should be used when continuing this thread.

Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlan.h Tue May 17 20:59:10 2016
@@ -12,13 +12,13 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
 #include "lldb/Core/UserID.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
@@ -632,7 +632,7 @@ private:
 
     ThreadPlanKind m_kind;
     std::string m_name;
-    Mutex m_plan_complete_mutex;
+    std::recursive_mutex m_plan_complete_mutex;
     LazyBool m_cached_plan_explains_stop;
     bool m_plan_complete;
     bool m_plan_private;

Modified: lldb/trunk/include/lldb/Target/ThreadPlanPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanPython.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanPython.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanPython.h Tue May 17 20:59:10 2016
@@ -19,7 +19,6 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Core/StructuredData.h"
 #include "lldb/Core/UserID.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"

Modified: lldb/trunk/include/lldb/Target/Unwind.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Unwind.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Unwind.h (original)
+++ lldb/trunk/include/lldb/Target/Unwind.h Tue May 17 20:59:10 2016
@@ -12,10 +12,11 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private {
 
@@ -25,11 +26,7 @@ protected:
     //------------------------------------------------------------------
     // Classes that inherit from Unwind can see and modify these
     //------------------------------------------------------------------
-    Unwind(Thread &thread) :
-        m_thread (thread),
-        m_unwind_mutex(Mutex::eMutexTypeRecursive)
-    {
-    }
+    Unwind(Thread &thread) : m_thread(thread), m_unwind_mutex() {}
 
 public:
     virtual
@@ -40,18 +37,17 @@ public:
     void
     Clear()
     {
-        Mutex::Locker locker(m_unwind_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
         DoClear();
-    
     }
 
     uint32_t
     GetFrameCount()
     {
-        Mutex::Locker locker(m_unwind_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
         return DoGetFrameCount();
     }
-    
+
     uint32_t
     GetFramesUpTo (uint32_t end_idx)
     {
@@ -70,21 +66,19 @@ public:
     }
 
     bool
-    GetFrameInfoAtIndex (uint32_t frame_idx,
-                         lldb::addr_t& cfa, 
-                         lldb::addr_t& pc)
+    GetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, lldb::addr_t &pc)
     {
-        Mutex::Locker locker(m_unwind_mutex);
-        return DoGetFrameInfoAtIndex (frame_idx, cfa, pc);
+        std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
+        return DoGetFrameInfoAtIndex(frame_idx, cfa, pc);
     }
-    
+
     lldb::RegisterContextSP
-    CreateRegisterContextForFrame (StackFrame *frame)
+    CreateRegisterContextForFrame(StackFrame *frame)
     {
-        Mutex::Locker locker(m_unwind_mutex);
-        return DoCreateRegisterContextForFrame (frame);
+        std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
+        return DoCreateRegisterContextForFrame(frame);
     }
-    
+
     Thread &
     GetThread()
     {
@@ -110,7 +104,8 @@ protected:
     DoCreateRegisterContextForFrame (StackFrame *frame) = 0;
 
     Thread &m_thread;
-    Mutex  m_unwind_mutex;
+    std::recursive_mutex m_unwind_mutex;
+
 private:
     DISALLOW_COPY_AND_ASSIGN (Unwind);
 };

Modified: lldb/trunk/include/lldb/Utility/SharedCluster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharedCluster.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharedCluster.h (original)
+++ lldb/trunk/include/lldb/Utility/SharedCluster.h Tue May 17 20:59:10 2016
@@ -11,7 +11,6 @@
 #define utility_SharedCluster_h_
 
 #include "lldb/Utility/SharingPtr.h"
-#include "lldb/Host/Mutex.h"
 
 #include "llvm/ADT/SmallPtrSet.h"
 
@@ -46,14 +45,12 @@ template <class T>
 class ClusterManager
 {
 public:
-    ClusterManager () : 
-        m_objects(),
-        m_external_ref(0),
-        m_mutex(Mutex::eMutexTypeNormal) {}
-    
-    ~ClusterManager ()
+    ClusterManager() : m_objects(), m_external_ref(0), m_mutex() {}
+
+    ~ClusterManager()
     {
-        for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(), end = m_objects.end(); pos != end; ++pos)
+        for (typename llvm::SmallPtrSet<T *, 16>::iterator pos = m_objects.begin(), end = m_objects.end(); pos != end;
+             ++pos)
         {
             T *object = *pos;
             delete object;
@@ -62,42 +59,44 @@ public:
         // Decrement refcount should have been called on this ClusterManager,
         // and it should have locked the mutex, now we will unlock it before
         // we destroy it...
-        m_mutex.Unlock();
+        m_mutex.unlock();
     }
-    
-    void ManageObject (T *new_object)
+
+    void
+    ManageObject(T *new_object)
     {
-        Mutex::Locker locker (m_mutex);
-        m_objects.insert (new_object);
+        std::lock_guard<std::mutex> guard(m_mutex);
+        m_objects.insert(new_object);
     }
-    
-    typename lldb_private::SharingPtr<T> GetSharedPointer(T *desired_object)
+
+    typename lldb_private::SharingPtr<T>
+    GetSharedPointer(T *desired_object)
     {
         {
-            Mutex::Locker locker (m_mutex);
+            std::lock_guard<std::mutex> guard(m_mutex);
             m_external_ref++;
-            assert (m_objects.count(desired_object));
+            assert(m_objects.count(desired_object));
         }
-        return typename lldb_private::SharingPtr<T> (desired_object, new imp::shared_ptr_refcount<ClusterManager> (this));
+        return typename lldb_private::SharingPtr<T>(desired_object, new imp::shared_ptr_refcount<ClusterManager>(this));
     }
-    
+
 private:
-    
-    void DecrementRefCount () 
+    void
+    DecrementRefCount()
     {
-        m_mutex.Lock();
+        m_mutex.lock();
         m_external_ref--;
         if (m_external_ref == 0)
             delete this;
         else
-            m_mutex.Unlock();
+            m_mutex.unlock();
     }
-    
+
     friend class imp::shared_ptr_refcount<ClusterManager>;
-    
+
     llvm::SmallPtrSet<T *, 16> m_objects;
     int m_external_ref;
-    Mutex m_mutex;
+    std::mutex m_mutex;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Tue May 17 20:59:10 2016
@@ -191,8 +191,8 @@ SBDebugger::Create(bool source_init_file
     // uses global collections and having two threads parsing the .lldbinit files can cause
     // mayhem. So to get around this for now we need to use a mutex to prevent bad things
     // from happening.
-    static Mutex g_mutex(Mutex::eMutexTypeRecursive);
-    Mutex::Locker locker(g_mutex);
+    static std::recursive_mutex g_mutex;
+    std::lock_guard<std::recursive_mutex> guard(g_mutex);
 
     debugger.reset(Debugger::CreateInstance(callback, baton));
 

Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Tue May 17 20:59:10 2016
@@ -24,13 +24,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointLocationList::BreakpointLocationList(Breakpoint &owner) :
-    m_owner (owner),
-    m_locations(),
-    m_address_to_location (),
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_next_id (0),
-    m_new_location_recorder (nullptr)
+BreakpointLocationList::BreakpointLocationList(Breakpoint &owner)
+    : m_owner(owner), m_locations(), m_address_to_location(), m_mutex(), m_next_id(0), m_new_location_recorder(nullptr)
 {
 }
 
@@ -39,7 +34,7 @@ BreakpointLocationList::~BreakpointLocat
 BreakpointLocationSP
 BreakpointLocationList::Create (const Address &addr, bool resolve_indirect_symbols)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // The location ID is just the size of the location list + 1
     lldb::break_id_t bp_loc_id = ++m_next_id;
     BreakpointLocationSP bp_loc_sp (new BreakpointLocation (bp_loc_id, m_owner, addr, LLDB_INVALID_THREAD_ID, m_owner.IsHardware(), resolve_indirect_symbols));
@@ -84,7 +79,7 @@ Compare (BreakpointLocationSP lhs, lldb:
 BreakpointLocationSP
 BreakpointLocationList::FindByID (lldb::break_id_t break_id) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::const_iterator end = m_locations.end();
     collection::const_iterator pos = std::lower_bound(m_locations.begin(), end, break_id, Compare);
     if (pos != end && (*pos)->GetID() == break_id)
@@ -97,7 +92,7 @@ size_t
 BreakpointLocationList::FindInModule (Module *module,
                                       BreakpointLocationCollection& bp_loc_list)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const size_t orig_size = bp_loc_list.GetSize();
     collection::iterator pos, end = m_locations.end();
 
@@ -116,7 +111,7 @@ BreakpointLocationList::FindInModule (Mo
 const BreakpointLocationSP
 BreakpointLocationList::FindByAddress (const Address &addr) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointLocationSP bp_loc_sp;
     if (!m_locations.empty())
     {
@@ -150,7 +145,7 @@ BreakpointLocationList::Dump (Stream *s)
 {
     s->Printf("%p: ", static_cast<const void*>(this));
     //s->Indent();
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     s->Printf("BreakpointLocationList with %" PRIu64 " BreakpointLocations:\n", (uint64_t)m_locations.size());
     s->IndentMore();
     collection::const_iterator pos, end = m_locations.end();
@@ -162,7 +157,7 @@ BreakpointLocationList::Dump (Stream *s)
 BreakpointLocationSP
 BreakpointLocationList::GetByIndex (size_t i)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointLocationSP bp_loc_sp;
     if (i < m_locations.size())
         bp_loc_sp = m_locations[i];
@@ -173,7 +168,7 @@ BreakpointLocationList::GetByIndex (size
 const BreakpointLocationSP
 BreakpointLocationList::GetByIndex (size_t i) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointLocationSP bp_loc_sp;
     if (i < m_locations.size())
         bp_loc_sp = m_locations[i];
@@ -184,7 +179,7 @@ BreakpointLocationList::GetByIndex (size
 void
 BreakpointLocationList::ClearAllBreakpointSites ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator pos, end = m_locations.end();
     for (pos = m_locations.begin(); pos != end; ++pos)
         (*pos)->ClearBreakpointSite();
@@ -193,7 +188,7 @@ BreakpointLocationList::ClearAllBreakpoi
 void
 BreakpointLocationList::ResolveAllBreakpointSites ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator pos, end = m_locations.end();
 
     for (pos = m_locations.begin(); pos != end; ++pos)
@@ -207,7 +202,7 @@ uint32_t
 BreakpointLocationList::GetHitCount () const
 {
     uint32_t hit_count = 0;
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::const_iterator pos, end = m_locations.end();
     for (pos = m_locations.begin(); pos != end; ++pos)
         hit_count += (*pos)->GetHitCount();
@@ -217,7 +212,7 @@ BreakpointLocationList::GetHitCount () c
 size_t
 BreakpointLocationList::GetNumResolvedLocations() const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     size_t resolve_count = 0;
     collection::const_iterator pos, end = m_locations.end();
     for (pos = m_locations.begin(); pos != end; ++pos)
@@ -231,7 +226,7 @@ BreakpointLocationList::GetNumResolvedLo
 void
 BreakpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator pos, end = m_locations.end();
 
     for (pos = m_locations.begin(); pos != end; ++pos)
@@ -244,7 +239,7 @@ BreakpointLocationList::GetDescription (
 BreakpointLocationSP
 BreakpointLocationList::AddLocation (const Address &addr, bool resolve_indirect_symbols, bool *new_location)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (new_location)
         *new_location = false;
@@ -285,8 +280,8 @@ BreakpointLocationList::RemoveLocation (
 {
     if (bp_loc_sp)
     {
-        Mutex::Locker locker (m_mutex);
-        
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
+
         m_address_to_location.erase (bp_loc_sp->GetAddress());
 
         collection::iterator pos, end = m_locations.end();
@@ -305,7 +300,7 @@ BreakpointLocationList::RemoveLocation (
 void
 BreakpointLocationList::RemoveInvalidLocations (const ArchSpec &arch)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     size_t idx = 0;
     // Don't cache m_location.size() as it will change since we might
     // remove locations from our vector...
@@ -341,7 +336,7 @@ BreakpointLocationList::RemoveInvalidLoc
 void
 BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection &new_locations)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     assert(m_new_location_recorder == nullptr);
     m_new_location_recorder = &new_locations;
 }
@@ -349,7 +344,7 @@ BreakpointLocationList::StartRecordingNe
 void
 BreakpointLocationList::StopRecordingNewLocations ()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_new_location_recorder = nullptr;
 }
 

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Tue May 17 20:59:10 2016
@@ -23,17 +23,15 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointSite::BreakpointSite(BreakpointSiteList *list,
-                               const BreakpointLocationSP& owner,
-                               lldb::addr_t addr,
-                               bool use_hardware) :
-    StoppointLocation(GetNextID(), addr, 0, use_hardware),
-    m_type (eSoftware), // Process subclasses need to set this correctly using SetType()
-    m_saved_opcode(),
-    m_trap_opcode(),
-    m_enabled(false), // Need to create it disabled, so the first enable turns it on.
-    m_owners(),
-    m_owners_mutex(Mutex::eMutexTypeRecursive)
+BreakpointSite::BreakpointSite(BreakpointSiteList *list, const BreakpointLocationSP &owner, lldb::addr_t addr,
+                               bool use_hardware)
+    : StoppointLocation(GetNextID(), addr, 0, use_hardware),
+      m_type(eSoftware), // Process subclasses need to set this correctly using SetType()
+      m_saved_opcode(),
+      m_trap_opcode(),
+      m_enabled(false), // Need to create it disabled, so the first enable turns it on.
+      m_owners(),
+      m_owners_mutex()
 {
     m_owners.Add(owner);
 }
@@ -61,7 +59,7 @@ BreakpointSite::GetNextID()
 bool
 BreakpointSite::ShouldStop (StoppointCallbackContext *context)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     IncrementHitCount();
     return m_owners.ShouldStop (context);
 }
@@ -69,7 +67,7 @@ BreakpointSite::ShouldStop (StoppointCal
 bool
 BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     const size_t owner_count = m_owners.GetSize();
     for (size_t i = 0; i < owner_count; i++)
     {
@@ -96,7 +94,7 @@ BreakpointSite::Dump(Stream *s) const
 void
 BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     if (level != lldb::eDescriptionLevelBrief)
         s->Printf ("breakpoint site: %d at 0x%8.8" PRIx64, GetID(), GetLoadAddress());
     m_owners.GetDescription (s, level);
@@ -166,14 +164,14 @@ BreakpointSite::SetEnabled (bool enabled
 void
 BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     m_owners.Add(owner);
 }
 
 size_t
 BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     m_owners.Remove(break_id, break_loc_id);
     return m_owners.GetSize();
 }
@@ -181,28 +179,28 @@ BreakpointSite::RemoveOwner (lldb::break
 size_t
 BreakpointSite::GetNumberOfOwners ()
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     return m_owners.GetSize();
 }
 
 BreakpointLocationSP
 BreakpointSite::GetOwnerAtIndex (size_t index)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     return m_owners.GetByIndex (index);
 }
 
 bool
 BreakpointSite::ValidForThisThread (Thread *thread)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     return m_owners.ValidForThisThread(thread);
 }
 
 void
 BreakpointSite::BumpHitCounts()
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
     {
         loc_sp->BumpHitCount();
@@ -255,7 +253,7 @@ BreakpointSite::IntersectsRange(lldb::ad
 size_t
 BreakpointSite::CopyOwnersList (BreakpointLocationCollection &out_collection)
 {
-    Mutex::Locker locker(m_owners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
     for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
     {
         out_collection.Add(loc_sp);

Modified: lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp Tue May 17 20:59:10 2016
@@ -19,9 +19,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointSiteList::BreakpointSiteList() :
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_bp_site_list()
+BreakpointSiteList::BreakpointSiteList() : m_mutex(), m_bp_site_list()
 {
 }
 
@@ -36,7 +34,7 @@ lldb::break_id_t
 BreakpointSiteList::Add(const BreakpointSiteSP &bp)
 {
     lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator iter = m_bp_site_list.find (bp_site_load_addr);
 
     if (iter == m_bp_site_list.end())
@@ -81,7 +79,7 @@ BreakpointSiteList::FindIDByAddress (lld
 bool
 BreakpointSiteList::Remove (lldb::break_id_t break_id)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator pos = GetIDIterator(break_id);    // Predicate
     if (pos != m_bp_site_list.end())
     {
@@ -94,7 +92,7 @@ BreakpointSiteList::Remove (lldb::break_
 bool
 BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator pos =  m_bp_site_list.find(address);
     if (pos != m_bp_site_list.end())
     {
@@ -124,7 +122,7 @@ private:
 BreakpointSiteList::collection::iterator
 BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(),   // Search full range
                         BreakpointSiteIDMatches(break_id));             // Predicate
 }
@@ -132,7 +130,7 @@ BreakpointSiteList::GetIDIterator (lldb:
 BreakpointSiteList::collection::const_iterator
 BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(),   // Search full range
                         BreakpointSiteIDMatches(break_id));             // Predicate
 }
@@ -140,7 +138,7 @@ BreakpointSiteList::GetIDConstIterator (
 BreakpointSiteSP
 BreakpointSiteList::FindByID (lldb::break_id_t break_id)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointSiteSP stop_sp;
     collection::iterator pos = GetIDIterator(break_id);
     if (pos != m_bp_site_list.end())
@@ -152,7 +150,7 @@ BreakpointSiteList::FindByID (lldb::brea
 const BreakpointSiteSP
 BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     BreakpointSiteSP stop_sp;
     collection::const_iterator pos = GetIDConstIterator(break_id);
     if (pos != m_bp_site_list.end())
@@ -165,7 +163,7 @@ BreakpointSiteSP
 BreakpointSiteList::FindByAddress (lldb::addr_t addr)
 {
     BreakpointSiteSP found_sp;
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::iterator iter =  m_bp_site_list.find(addr);
     if (iter != m_bp_site_list.end())
         found_sp = iter->second;
@@ -175,7 +173,7 @@ BreakpointSiteList::FindByAddress (lldb:
 bool
 BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::const_iterator pos = GetIDConstIterator(bp_site_id);
     if (pos != m_bp_site_list.end())
         return pos->second->IsBreakpointAtThisSite (bp_id);
@@ -200,7 +198,7 @@ BreakpointSiteList::Dump (Stream *s) con
 void
 BreakpointSiteList::ForEach (std::function <void(BreakpointSite *)> const &callback)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     for (auto pair : m_bp_site_list)
         callback (pair.second.get());
 }
@@ -210,8 +208,8 @@ BreakpointSiteList::FindInRange (lldb::a
 {
     if (lower_bound > upper_bound)
         return false;
-    
-    Mutex::Locker locker(m_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     collection::const_iterator lower, upper, pos;
     lower = m_bp_site_list.lower_bound(lower_bound);
     if (lower == m_bp_site_list.end()

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue May 17 20:59:10 2016
@@ -1978,7 +1978,7 @@ FindModulesByName (Target *target,
     if (check_global_list)
     {
         // Check the global list
-        Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
+        std::lock_guard<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex());
         const size_t num_modules = Module::GetNumberAllocatedModules();
         ModuleSP module_sp;
         for (size_t image_idx = 0; image_idx<num_modules; ++image_idx)
@@ -2470,7 +2470,7 @@ protected:
                     else
                     {
                         // Check the global list
-                        Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
+                        std::lock_guard<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex());
 
                         result.AppendWarningWithFormat("Unable to find an image that matches '%s'.\n", arg_cstr);
                     }
@@ -3291,16 +3291,20 @@ protected:
             }
 
             size_t num_modules = 0;
-            Mutex::Locker locker;      // This locker will be locked on the mutex in module_list_ptr if it is non-nullptr.
-                                       // Otherwise it will lock the AllocationModuleCollectionMutex when accessing
-                                       // the global module list directly.
+
+            // This locker will be locked on the mutex in module_list_ptr if it is non-nullptr.
+            // 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();
             if (argc == 0)
             {
                 if (use_global_module_list)
                 {
-                    locker.Lock (Module::GetAllocationModuleCollectionMutex());
+                    guard.lock();
                     num_modules = Module::GetNumberAllocatedModules();
                 }
                 else
@@ -3331,6 +3335,7 @@ protected:
 
             if (module_list_ptr != nullptr)
             {
+                assert(use_global_module_list == false && "locking violation");
                 locker.Lock(module_list_ptr->GetMutex());
                 num_modules = module_list_ptr->GetSize();
             }

Modified: lldb/trunk/source/Core/Broadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Broadcaster.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Broadcaster.cpp (original)
+++ lldb/trunk/source/Core/Broadcaster.cpp Tue May 17 20:59:10 2016
@@ -32,12 +32,8 @@ Broadcaster::Broadcaster(BroadcasterMana
                      static_cast<void*>(this), GetBroadcasterName().AsCString());
 }
 
-Broadcaster::BroadcasterImpl::BroadcasterImpl (Broadcaster &broadcaster) :
-    m_broadcaster(broadcaster),
-    m_listeners (),
-    m_listeners_mutex (Mutex::eMutexTypeRecursive),
-    m_hijacking_listeners(),
-    m_hijacking_masks()
+Broadcaster::BroadcasterImpl::BroadcasterImpl(Broadcaster &broadcaster)
+    : m_broadcaster(broadcaster), m_listeners(), m_listeners_mutex(), m_hijacking_listeners(), m_hijacking_masks()
 {
 }
 
@@ -90,8 +86,8 @@ Broadcaster::BroadcasterImpl::ListenerIt
 void
 Broadcaster::BroadcasterImpl::Clear()
 {
-    Mutex::Locker listeners_locker(m_listeners_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
+
     // Make sure the listener forgets about this broadcaster. We do
     // this in the broadcaster in case the broadcaster object initiates
     // the removal.
@@ -152,7 +148,7 @@ Broadcaster::BroadcasterImpl::AddListene
     if (!listener_sp)
         return 0;
 
-    Mutex::Locker locker(m_listeners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
 
     // See if we already have this listener, and if so, update its mask
 
@@ -186,8 +182,8 @@ Broadcaster::BroadcasterImpl::AddListene
 bool
 Broadcaster::BroadcasterImpl::EventTypeHasListeners (uint32_t event_type)
 {
-    Mutex::Locker locker (m_listeners_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
+
     if (!m_hijacking_listeners.empty() && event_type & m_hijacking_masks.back())
         return true;
         
@@ -215,7 +211,7 @@ Broadcaster::BroadcasterImpl::RemoveList
 {
     if (listener)
     {
-        Mutex::Locker locker(m_listeners_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
         collection::iterator pos = m_listeners.begin();
         // See if we already have this listener, and if so, update its mask
         while (pos != m_listeners.end())
@@ -275,7 +271,7 @@ Broadcaster::BroadcasterImpl::PrivateBro
 
     const uint32_t event_type = event_sp->GetType();
 
-    Mutex::Locker locker(m_listeners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
 
     ListenerSP hijacking_listener_sp;
 
@@ -343,7 +339,7 @@ Broadcaster::BroadcasterImpl::BroadcastE
 bool
 Broadcaster::BroadcasterImpl::HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask)
 {
-    Mutex::Locker locker(m_listeners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
 
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EVENTS));
     if (log)
@@ -358,7 +354,7 @@ Broadcaster::BroadcasterImpl::HijackBroa
 bool
 Broadcaster::BroadcasterImpl::IsHijackedForEvent (uint32_t event_mask)
 {
-    Mutex::Locker locker(m_listeners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
 
     if (!m_hijacking_listeners.empty())
         return (event_mask & m_hijacking_masks.back()) != 0;
@@ -381,7 +377,7 @@ Broadcaster::BroadcasterImpl::GetHijacki
 void
 Broadcaster::BroadcasterImpl::RestoreBroadcaster ()
 {
-    Mutex::Locker locker(m_listeners_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
 
     if (!m_hijacking_listeners.empty())
     {
@@ -425,8 +421,7 @@ BroadcastEventSpec::operator< (const Bro
 BroadcastEventSpec &
 BroadcastEventSpec::operator=(const BroadcastEventSpec &rhs) = default;
 
-BroadcasterManager::BroadcasterManager() :
-    m_manager_mutex(Mutex::eMutexTypeRecursive)
+BroadcasterManager::BroadcasterManager() : m_manager_mutex()
 {
 }
 
@@ -439,8 +434,8 @@ BroadcasterManager::MakeBroadcasterManag
 uint32_t
 BroadcasterManager::RegisterListenerForEvents (const lldb::ListenerSP &listener_sp, BroadcastEventSpec event_spec)
 {
-    Mutex::Locker locker(m_manager_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
+
     collection::iterator iter = m_event_map.begin(), end_iter = m_event_map.end();
     uint32_t available_bits = event_spec.GetEventBits();
     
@@ -463,7 +458,7 @@ BroadcasterManager::RegisterListenerForE
 bool
 BroadcasterManager::UnregisterListenerForEvents (const lldb::ListenerSP &listener_sp, BroadcastEventSpec event_spec)
 {
-    Mutex::Locker locker(m_manager_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
     bool removed_some = false;
     
     if (m_listeners.erase(listener_sp) == 0)
@@ -508,8 +503,8 @@ BroadcasterManager::UnregisterListenerFo
 ListenerSP
 BroadcasterManager::GetListenerForEventSpec (BroadcastEventSpec event_spec) const
 {
-    Mutex::Locker locker(*(const_cast<Mutex *> (&m_manager_mutex)));
-    
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
+
     collection::const_iterator iter, end_iter = m_event_map.end();
     iter = find_if (m_event_map.begin(), end_iter, BroadcastEventSpecMatches (event_spec));
     if (iter != end_iter)
@@ -521,7 +516,7 @@ BroadcasterManager::GetListenerForEventS
 void
 BroadcasterManager::RemoveListener(Listener *listener)
 {
-    Mutex::Locker locker(m_manager_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
     ListenerMatchesPointer predicate (listener);
     listener_collection::iterator iter = m_listeners.begin(), end_iter = m_listeners.end();
     
@@ -543,7 +538,7 @@ BroadcasterManager::RemoveListener(Liste
 void
 BroadcasterManager::RemoveListener (const lldb::ListenerSP &listener_sp)
 {
-    Mutex::Locker locker(m_manager_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
     ListenerMatches predicate (listener_sp);
 
     if (m_listeners.erase (listener_sp) == 0)
@@ -563,8 +558,8 @@ BroadcasterManager::RemoveListener (cons
 void
 BroadcasterManager::SignUpListenersForBroadcaster (Broadcaster &broadcaster)
 {
-    Mutex::Locker locker(m_manager_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
+
     collection::iterator iter = m_event_map.begin(), end_iter = m_event_map.end();
     
     while (iter != end_iter 
@@ -578,7 +573,7 @@ BroadcasterManager::SignUpListenersForBr
 void
 BroadcasterManager::Clear ()
 {
-    Mutex::Locker locker(m_manager_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_manager_mutex);
     listener_collection::iterator end_iter = m_listeners.end();
     
     for (listener_collection::iterator iter = m_listeners.begin(); iter != end_iter; iter++)

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Tue May 17 20:59:10 2016
@@ -33,31 +33,30 @@ Communication::GetStaticBroadcasterClass
     return class_name;
 }
 
-Communication::Communication(const char *name) :
-    Broadcaster(nullptr, name),
-    m_connection_sp(),
-    m_read_thread_enabled(false),
-    m_read_thread_did_exit(false),
-    m_bytes(),
-    m_bytes_mutex(Mutex::eMutexTypeRecursive),
-    m_write_mutex(Mutex::eMutexTypeNormal),
-    m_synchronize_mutex(Mutex::eMutexTypeNormal),
-    m_callback(nullptr),
-    m_callback_baton(nullptr),
-    m_close_on_eof(true)
+Communication::Communication(const char *name)
+    : Broadcaster(nullptr, name),
+      m_connection_sp(),
+      m_read_thread_enabled(false),
+      m_read_thread_did_exit(false),
+      m_bytes(),
+      m_bytes_mutex(),
+      m_write_mutex(),
+      m_synchronize_mutex(),
+      m_callback(nullptr),
+      m_callback_baton(nullptr),
+      m_close_on_eof(true)
+
+{
+    lldb_private::LogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION,
+                                        "%p Communication::Communication (name = %s)", this, name);
+
+    SetEventName(eBroadcastBitDisconnected, "disconnected");
+    SetEventName(eBroadcastBitReadThreadGotBytes, "got bytes");
+    SetEventName(eBroadcastBitReadThreadDidExit, "read thread did exit");
+    SetEventName(eBroadcastBitReadThreadShouldExit, "read thread should exit");
+    SetEventName(eBroadcastBitPacketAvailable, "packet available");
+    SetEventName(eBroadcastBitNoMorePendingInput, "no more pending input");
 
-{
-    lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION,
-                                 "%p Communication::Communication (name = %s)",
-                                 this, name);
-
-    SetEventName (eBroadcastBitDisconnected, "disconnected");
-    SetEventName (eBroadcastBitReadThreadGotBytes, "got bytes");
-    SetEventName (eBroadcastBitReadThreadDidExit, "read thread did exit");
-    SetEventName (eBroadcastBitReadThreadShouldExit, "read thread should exit");
-    SetEventName (eBroadcastBitPacketAvailable, "packet available");
-    SetEventName (eBroadcastBitNoMorePendingInput, "no more pending input");
-    
     CheckInWithManager();
 }
 
@@ -205,7 +204,7 @@ Communication::Write (const void *src, s
 {
     lldb::ConnectionSP connection_sp (m_connection_sp);
 
-    Mutex::Locker locker(m_write_mutex);
+    std::lock_guard<std::mutex> guard(m_write_mutex);
     lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
                                          "%p Communication::Write (src = %p, src_len = %" PRIu64 ") connection = %p",
                                          this, 
@@ -277,7 +276,7 @@ Communication::JoinReadThread (Error *er
 size_t
 Communication::GetCachedBytes (void *dst, size_t dst_len)
 {
-    Mutex::Locker locker(m_bytes_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
     if (!m_bytes.empty())
     {
         // If DST is nullptr and we have a thread, then return the number
@@ -311,7 +310,7 @@ Communication::AppendBytesToCache (const
     }
     else if (bytes != nullptr && len > 0)
     {
-        Mutex::Locker locker(m_bytes_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
         m_bytes.append ((const char *)bytes, len);
         if (broadcast)
             BroadcastEventIfUnique (eBroadcastBitReadThreadGotBytes);
@@ -425,7 +424,7 @@ void
 Communication::SynchronizeWithReadThread ()
 {
     // Only one thread can do the synchronization dance at a time.
-    Mutex::Locker locker(m_synchronize_mutex);
+    std::lock_guard<std::mutex> guard(m_synchronize_mutex);
 
     // First start listening for the synchronization event.
     ListenerSP listener_sp(Listener::MakeListener("Communication::SyncronizeWithReadThread"));

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue May 17 20:59:10 2016
@@ -12,6 +12,7 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
@@ -67,10 +68,10 @@ static size_t g_debugger_event_thread_st
 
 #pragma mark Static Functions
 
-static Mutex &
-GetDebuggerListMutex ()
+static std::recursive_mutex &
+GetDebuggerListMutex()
 {
-    static Mutex g_mutex(Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_mutex;
     return g_mutex;
 }
 
@@ -469,7 +470,7 @@ Debugger::Terminate ()
     assert(lldb_initialized && "Debugger::Terminate called without a matching Debugger::Initialize!");
 
     // Clear our master list of debugger objects
-    Mutex::Locker locker (GetDebuggerListMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
     auto& debuggers = GetDebuggerList();
     for (const auto& debugger: debuggers)
         debugger->Clear();
@@ -605,7 +606,7 @@ Debugger::CreateInstance (lldb::LogOutpu
     DebuggerSP debugger_sp (new Debugger(log_callback, baton));
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         GetDebuggerList().push_back(debugger_sp);
     }
     debugger_sp->InstanceInitialize ();
@@ -622,7 +623,7 @@ Debugger::Destroy (DebuggerSP &debugger_
 
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         DebuggerList &debugger_list = GetDebuggerList ();
         DebuggerList::iterator pos, end = debugger_list.end();
         for (pos = debugger_list.begin (); pos != end; ++pos)
@@ -642,7 +643,7 @@ Debugger::FindDebuggerWithInstanceName (
     DebuggerSP debugger_sp;
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         DebuggerList &debugger_list = GetDebuggerList();
         DebuggerList::iterator pos, end = debugger_list.end();
 
@@ -664,7 +665,7 @@ Debugger::FindTargetWithProcessID (lldb:
     TargetSP target_sp;
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         DebuggerList &debugger_list = GetDebuggerList();
         DebuggerList::iterator pos, end = debugger_list.end();
         for (pos = debugger_list.begin(); pos != end; ++pos)
@@ -683,7 +684,7 @@ Debugger::FindTargetWithProcess (Process
     TargetSP target_sp;
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         DebuggerList &debugger_list = GetDebuggerList();
         DebuggerList::iterator pos, end = debugger_list.end();
         for (pos = debugger_list.begin(); pos != end; ++pos)
@@ -922,33 +923,33 @@ Debugger::GetSelectedExecutionContext ()
 }
 
 void
-Debugger::DispatchInputInterrupt ()
+Debugger::DispatchInputInterrupt()
 {
-    Mutex::Locker locker (m_input_reader_stack.GetMutex());
-    IOHandlerSP reader_sp (m_input_reader_stack.Top());
+    std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
+    IOHandlerSP reader_sp(m_input_reader_stack.Top());
     if (reader_sp)
         reader_sp->Interrupt();
 }
 
 void
-Debugger::DispatchInputEndOfFile ()
+Debugger::DispatchInputEndOfFile()
 {
-    Mutex::Locker locker (m_input_reader_stack.GetMutex());
-    IOHandlerSP reader_sp (m_input_reader_stack.Top());
+    std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
+    IOHandlerSP reader_sp(m_input_reader_stack.Top());
     if (reader_sp)
         reader_sp->GotEOF();
 }
 
 void
-Debugger::ClearIOHandlers ()
+Debugger::ClearIOHandlers()
 {
     // The bottom input reader should be the main debugger input reader.  We do not want to close that one here.
-    Mutex::Locker locker (m_input_reader_stack.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
     while (m_input_reader_stack.GetSize() > 1)
     {
-        IOHandlerSP reader_sp (m_input_reader_stack.Top());
+        IOHandlerSP reader_sp(m_input_reader_stack.Top());
         if (reader_sp)
-            PopIOHandler (reader_sp);
+            PopIOHandler(reader_sp);
     }
 }
 
@@ -1041,16 +1042,16 @@ Debugger::RunIOHandler (const IOHandlerS
 }
 
 void
-Debugger::AdoptTopIOHandlerFilesIfInvalid (StreamFileSP &in, StreamFileSP &out, StreamFileSP &err)
+Debugger::AdoptTopIOHandlerFilesIfInvalid(StreamFileSP &in, StreamFileSP &out, StreamFileSP &err)
 {
     // Before an IOHandler runs, it must have in/out/err streams.
     // This function is called when one ore more of the streams
     // are nullptr. We use the top input reader's in/out/err streams,
     // or fall back to the debugger file handles, or we fall back
     // onto stdin/stdout/stderr as a last resort.
-    
-    Mutex::Locker locker (m_input_reader_stack.GetMutex());
-    IOHandlerSP top_reader_sp (m_input_reader_stack.Top());
+
+    std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
+    IOHandlerSP top_reader_sp(m_input_reader_stack.Top());
     // If no STDIN has been set, then set it appropriately
     if (!in)
     {
@@ -1058,7 +1059,7 @@ Debugger::AdoptTopIOHandlerFilesIfInvali
             in = top_reader_sp->GetInputStreamFile();
         else
             in = GetInputFile();
-        
+
         // If there is nothing, use stdin
         if (!in)
             in = StreamFileSP(new StreamFile(stdin, false));
@@ -1070,7 +1071,7 @@ Debugger::AdoptTopIOHandlerFilesIfInvali
             out = top_reader_sp->GetOutputStreamFile();
         else
             out = GetOutputFile();
-        
+
         // If there is nothing, use stdout
         if (!out)
             out = StreamFileSP(new StreamFile(stdout, false));
@@ -1082,31 +1083,30 @@ Debugger::AdoptTopIOHandlerFilesIfInvali
             err = top_reader_sp->GetErrorStreamFile();
         else
             err = GetErrorFile();
-        
+
         // If there is nothing, use stderr
         if (!err)
             err = StreamFileSP(new StreamFile(stdout, false));
-        
     }
 }
 
 void
-Debugger::PushIOHandler (const IOHandlerSP& reader_sp)
+Debugger::PushIOHandler(const IOHandlerSP &reader_sp)
 {
     if (!reader_sp)
         return;
- 
-    Mutex::Locker locker (m_input_reader_stack.GetMutex());
+
+    std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
 
     // Get the current top input reader...
-    IOHandlerSP top_reader_sp (m_input_reader_stack.Top());
-    
+    IOHandlerSP top_reader_sp(m_input_reader_stack.Top());
+
     // Don't push the same IO handler twice...
     if (reader_sp == top_reader_sp)
         return;
 
     // Push our new input reader
-    m_input_reader_stack.Push (reader_sp);
+    m_input_reader_stack.Push(reader_sp);
     reader_sp->Activate();
 
     // Interrupt the top input reader to it will exit its Run() function
@@ -1119,12 +1119,12 @@ Debugger::PushIOHandler (const IOHandler
 }
 
 bool
-Debugger::PopIOHandler (const IOHandlerSP& pop_reader_sp)
+Debugger::PopIOHandler(const IOHandlerSP &pop_reader_sp)
 {
-    if (! pop_reader_sp)
+    if (!pop_reader_sp)
         return false;
 
-    Mutex::Locker locker (m_input_reader_stack.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_input_reader_stack.GetMutex());
 
     // The reader on the stop of the stack is done, so let the next
     // read on the stack refresh its prompt and if there is one...
@@ -1138,7 +1138,7 @@ Debugger::PopIOHandler (const IOHandlerS
 
     reader_sp->Deactivate();
     reader_sp->Cancel();
-    m_input_reader_stack.Pop ();
+    m_input_reader_stack.Pop();
 
     reader_sp = m_input_reader_stack.Top();
     if (reader_sp)
@@ -1164,7 +1164,7 @@ Debugger::GetNumDebuggers()
 {
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         return GetDebuggerList().size();
     }
     return 0;
@@ -1177,9 +1177,9 @@ Debugger::GetDebuggerAtIndex (size_t ind
     
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         DebuggerList &debugger_list = GetDebuggerList();
-        
+
         if (index < debugger_list.size())
             debugger_sp = debugger_list[index];
     }
@@ -1194,7 +1194,7 @@ Debugger::FindDebuggerWithID (lldb::user
 
     if (lldb_initialized)
     {
-        Mutex::Locker locker (GetDebuggerListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDebuggerListMutex());
         DebuggerList &debugger_list = GetDebuggerList();
         DebuggerList::iterator pos, end = debugger_list.end();
         for (pos = debugger_list.begin(); pos != end; ++pos)

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Tue May 17 20:59:10 2016
@@ -169,13 +169,13 @@ IOHandler::WaitForPop ()
 }
 
 void
-IOHandlerStack::PrintAsync (Stream *stream, const char *s, size_t len)
+IOHandlerStack::PrintAsync(Stream *stream, const char *s, size_t len)
 {
     if (stream)
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         if (m_top)
-            m_top->PrintAsync (stream, s, len);
+            m_top->PrintAsync(stream, s, len);
     }
 }
 

Modified: lldb/trunk/source/Core/Listener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Listener.cpp (original)
+++ lldb/trunk/source/Core/Listener.cpp Tue May 17 20:59:10 2016
@@ -40,12 +40,8 @@ namespace
     };
 } // anonymous namespace
 
-Listener::Listener(const char *name) :
-    m_name (name),
-    m_broadcasters(),
-    m_broadcasters_mutex (Mutex::eMutexTypeRecursive),
-    m_events (),
-    m_events_mutex (Mutex::eMutexTypeNormal)
+Listener::Listener(const char *name)
+    : m_name(name), m_broadcasters(), m_broadcasters_mutex(), m_events(), m_events_mutex(Mutex::eMutexTypeNormal)
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log != nullptr)
@@ -67,7 +63,7 @@ void
 Listener::Clear()
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
-    Mutex::Locker locker(m_broadcasters_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
     broadcaster_collection::iterator pos, end = m_broadcasters.end();
     for (pos = m_broadcasters.begin(); pos != end; ++pos)
     {
@@ -100,7 +96,7 @@ Listener::StartListeningForEvents (Broad
         // Scope for "locker"
         // Tell the broadcaster to add this object as a listener
         {
-            Mutex::Locker locker(m_broadcasters_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
             Broadcaster::BroadcasterImplWP impl_wp(broadcaster->GetBroadcasterImpl());
             m_broadcasters.insert(std::make_pair(impl_wp, BroadcasterInfo(event_mask)));
         }
@@ -127,7 +123,7 @@ Listener::StartListeningForEvents (Broad
         // Scope for "locker"
         // Tell the broadcaster to add this object as a listener
         {
-            Mutex::Locker locker(m_broadcasters_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
             Broadcaster::BroadcasterImplWP impl_wp(broadcaster->GetBroadcasterImpl());
             m_broadcasters.insert(std::make_pair(impl_wp,
                                                  BroadcasterInfo(event_mask, callback, callback_user_data)));
@@ -158,7 +154,7 @@ Listener::StopListeningForEvents (Broadc
     {
         // Scope for "locker"
         {
-            Mutex::Locker locker(m_broadcasters_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
             m_broadcasters.erase (broadcaster->GetBroadcasterImpl());
         }
         // Remove the broadcaster from our set of broadcasters
@@ -175,7 +171,7 @@ Listener::BroadcasterWillDestruct (Broad
 {
     // Scope for "broadcasters_locker"
     {
-        Mutex::Locker broadcasters_locker(m_broadcasters_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
         m_broadcasters.erase (broadcaster->GetBroadcasterImpl());
     }
 
@@ -474,7 +470,7 @@ size_t
 Listener::HandleBroadcastEvent (EventSP &event_sp)
 {
     size_t num_handled = 0;
-    Mutex::Locker locker(m_broadcasters_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
     Broadcaster *broadcaster = event_sp->GetBroadcaster();
     if (!broadcaster)
         return 0;
@@ -507,8 +503,8 @@ Listener::StartListeningForEventSpec (Br
     
     // The BroadcasterManager mutex must be locked before m_broadcasters_mutex 
     // to avoid violating the lock hierarchy (manager before broadcasters).
-    Mutex::Locker manager_locker(manager_sp->m_manager_mutex);
-    Mutex::Locker locker(m_broadcasters_mutex);
+    std::lock_guard<std::recursive_mutex> manager_guard(manager_sp->m_manager_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
 
     uint32_t bits_acquired = manager_sp->RegisterListenerForEvents(this->shared_from_this(), event_spec);
     if (bits_acquired)
@@ -530,8 +526,8 @@ Listener::StopListeningForEventSpec (Bro
 {
     if (!manager_sp)
         return false;
-    
-    Mutex::Locker locker(m_broadcasters_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);
     return manager_sp->UnregisterListenerForEvents (this->shared_from_this(), event_spec);
 }
     

Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Tue May 17 20:59:10 2016
@@ -9,10 +9,11 @@
 
 // C Includes
 // C++ Includes
-#include <cstdio>
 #include <cstdarg>
+#include <cstdio>
 #include <cstdlib>
 #include <map>
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
@@ -26,7 +27,6 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/Host.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/ThisThread.h"
 #include "lldb/Host/TimeValue.h"
 #include "lldb/Interpreter/Args.h"
@@ -147,8 +147,8 @@ Log::VAPrintf(const char *format, va_lis
 
         if (m_options.Test(LLDB_LOG_OPTION_THREADSAFE))
         {
-            static Mutex g_LogThreadedMutex(Mutex::eMutexTypeRecursive);
-            Mutex::Locker locker(g_LogThreadedMutex);
+            static std::recursive_mutex g_LogThreadedMutex;
+            std::lock_guard<std::recursive_mutex> guard(g_LogThreadedMutex);
             stream_sp->PutCString(header.GetString().c_str());
             stream_sp->Flush();
         }

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue May 17 20:59:10 2016
@@ -72,7 +72,7 @@ GetModuleCollection()
     return *g_module_collection;
 }
 
-Mutex *
+std::recursive_mutex &
 Module::GetAllocationModuleCollectionMutex()
 {
     // NOTE: The mutex below must be leaked since the global module list in
@@ -80,23 +80,23 @@ Module::GetAllocationModuleCollectionMut
     // if it will tear itself down before the "g_module_collection_mutex" below
     // will. So we leak a Mutex object below to safeguard against that
 
-    static Mutex *g_module_collection_mutex = nullptr;
+    static std::recursive_mutex *g_module_collection_mutex = nullptr;
     if (g_module_collection_mutex == nullptr)
-        g_module_collection_mutex = new Mutex (Mutex::eMutexTypeRecursive); // NOTE: known leak
-    return g_module_collection_mutex;
+        g_module_collection_mutex = new std::recursive_mutex; // NOTE: known leak
+    return *g_module_collection_mutex;
 }
 
 size_t
 Module::GetNumberAllocatedModules ()
 {
-    Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
     return GetModuleCollection().size();
 }
 
 Module *
 Module::GetAllocatedModuleAtIndex (size_t idx)
 {
-    Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
     ModuleCollection &modules = GetModuleCollection();
     if (idx < modules.size())
         return modules[idx];
@@ -140,44 +140,42 @@ namespace lldb {
 
 #endif
 
-Module::Module (const ModuleSpec &module_spec) :
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_mod_time (),
-    m_arch (),
-    m_uuid (),
-    m_file (),
-    m_platform_file(),
-    m_remote_install_file(),
-    m_symfile_spec (),
-    m_object_name (),
-    m_object_offset (),
-    m_object_mod_time (),
-    m_objfile_sp (),
-    m_symfile_ap (),
-    m_type_system_map(),
-    m_source_mappings (),
-    m_sections_ap(),
-    m_did_load_objfile (false),
-    m_did_load_symbol_vendor (false),
-    m_did_parse_uuid (false),
-    m_file_has_changed (false),
-    m_first_file_changed_log (false)
+Module::Module(const ModuleSpec &module_spec)
+    : m_mutex(),
+      m_mod_time(),
+      m_arch(),
+      m_uuid(),
+      m_file(),
+      m_platform_file(),
+      m_remote_install_file(),
+      m_symfile_spec(),
+      m_object_name(),
+      m_object_offset(),
+      m_object_mod_time(),
+      m_objfile_sp(),
+      m_symfile_ap(),
+      m_type_system_map(),
+      m_source_mappings(),
+      m_sections_ap(),
+      m_did_load_objfile(false),
+      m_did_load_symbol_vendor(false),
+      m_did_parse_uuid(false),
+      m_file_has_changed(false),
+      m_first_file_changed_log(false)
 {
     // Scope for locker below...
     {
-        Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
         GetModuleCollection().push_back(this);
     }
 
-    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES));
     if (log != nullptr)
-        log->Printf ("%p Module::Module((%s) '%s%s%s%s')",
-                     static_cast<void*>(this),
-                     module_spec.GetArchitecture().GetArchitectureName(),
-                     module_spec.GetFileSpec().GetPath().c_str(),
-                     module_spec.GetObjectName().IsEmpty() ? "" : "(",
-                     module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""),
-                     module_spec.GetObjectName().IsEmpty() ? "" : ")");
+        log->Printf("%p Module::Module((%s) '%s%s%s%s')", static_cast<void *>(this),
+                    module_spec.GetArchitecture().GetArchitectureName(), module_spec.GetFileSpec().GetPath().c_str(),
+                    module_spec.GetObjectName().IsEmpty() ? "" : "(",
+                    module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""),
+                    module_spec.GetObjectName().IsEmpty() ? "" : ")");
 
     // First extract all module specifications from the file using the local
     // file path. If there are no specifications, then don't fill anything in
@@ -194,18 +192,18 @@ Module::Module (const ModuleSpec &module
     ModuleSpec matching_module_spec;
     if (modules_specs.FindMatchingModuleSpec(module_spec, matching_module_spec) == 0)
         return;
-    
+
     if (module_spec.GetFileSpec())
         m_mod_time = module_spec.GetFileSpec().GetModificationTime();
     else if (matching_module_spec.GetFileSpec())
         m_mod_time = matching_module_spec.GetFileSpec().GetModificationTime();
-    
+
     // Copy the architecture from the actual spec if we got one back, else use the one that was specified
     if (matching_module_spec.GetArchitecture().IsValid())
         m_arch = matching_module_spec.GetArchitecture();
     else if (module_spec.GetArchitecture().IsValid())
         m_arch = module_spec.GetArchitecture();
-    
+
     // Copy the file spec over and use the specified one (if there was one) so we
     // don't use a path that might have gotten resolved a path in 'matching_module_spec'
     if (module_spec.GetFileSpec())
@@ -218,57 +216,53 @@ Module::Module (const ModuleSpec &module
         m_platform_file = module_spec.GetPlatformFileSpec();
     else if (matching_module_spec.GetPlatformFileSpec())
         m_platform_file = matching_module_spec.GetPlatformFileSpec();
-    
+
     // Copy the symbol file spec over
     if (module_spec.GetSymbolFileSpec())
         m_symfile_spec = module_spec.GetSymbolFileSpec();
     else if (matching_module_spec.GetSymbolFileSpec())
         m_symfile_spec = matching_module_spec.GetSymbolFileSpec();
-    
+
     // Copy the object name over
     if (matching_module_spec.GetObjectName())
         m_object_name = matching_module_spec.GetObjectName();
     else
         m_object_name = module_spec.GetObjectName();
-    
+
     // Always trust the object offset (file offset) and object modification
     // time (for mod time in a BSD static archive) of from the matching
     // module specification
     m_object_offset = matching_module_spec.GetObjectOffset();
     m_object_mod_time = matching_module_spec.GetObjectModificationTime();
-    
 }
 
-Module::Module(const FileSpec& file_spec, 
-               const ArchSpec& arch, 
-               const ConstString *object_name, 
-               lldb::offset_t object_offset,
-               const TimeValue *object_mod_time_ptr) :
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_mod_time (file_spec.GetModificationTime()),
-    m_arch (arch),
-    m_uuid (),
-    m_file (file_spec),
-    m_platform_file(),
-    m_remote_install_file (),
-    m_symfile_spec (),
-    m_object_name (),
-    m_object_offset (object_offset),
-    m_object_mod_time (),
-    m_objfile_sp (),
-    m_symfile_ap (),
-    m_type_system_map(),
-    m_source_mappings (),
-    m_sections_ap(),
-    m_did_load_objfile (false),
-    m_did_load_symbol_vendor (false),
-    m_did_parse_uuid (false),
-    m_file_has_changed (false),
-    m_first_file_changed_log (false)
+Module::Module(const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name,
+               lldb::offset_t object_offset, const TimeValue *object_mod_time_ptr)
+    : m_mutex(),
+      m_mod_time(file_spec.GetModificationTime()),
+      m_arch(arch),
+      m_uuid(),
+      m_file(file_spec),
+      m_platform_file(),
+      m_remote_install_file(),
+      m_symfile_spec(),
+      m_object_name(),
+      m_object_offset(object_offset),
+      m_object_mod_time(),
+      m_objfile_sp(),
+      m_symfile_ap(),
+      m_type_system_map(),
+      m_source_mappings(),
+      m_sections_ap(),
+      m_did_load_objfile(false),
+      m_did_load_symbol_vendor(false),
+      m_did_parse_uuid(false),
+      m_file_has_changed(false),
+      m_first_file_changed_log(false)
 {
     // Scope for locker below...
     {
-        Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
         GetModuleCollection().push_back(this);
     }
 
@@ -278,40 +272,37 @@ Module::Module(const FileSpec& file_spec
     if (object_mod_time_ptr)
         m_object_mod_time = *object_mod_time_ptr;
 
-    Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES));
+    Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_MODULES));
     if (log != nullptr)
-        log->Printf ("%p Module::Module((%s) '%s%s%s%s')",
-                     static_cast<void*>(this), m_arch.GetArchitectureName(),
-                     m_file.GetPath().c_str(),
-                     m_object_name.IsEmpty() ? "" : "(",
-                     m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
-                     m_object_name.IsEmpty() ? "" : ")");
-}
-
-Module::Module () :
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_mod_time (),
-    m_arch (),
-    m_uuid (),
-    m_file (),
-    m_platform_file(),
-    m_remote_install_file (),
-    m_symfile_spec (),
-    m_object_name (),
-    m_object_offset (0),
-    m_object_mod_time (),
-    m_objfile_sp (),
-    m_symfile_ap (),
-    m_type_system_map(),
-    m_source_mappings (),
-    m_sections_ap(),
-    m_did_load_objfile (false),
-    m_did_load_symbol_vendor (false),
-    m_did_parse_uuid (false),
-    m_file_has_changed (false),
-    m_first_file_changed_log (false)
+        log->Printf("%p Module::Module((%s) '%s%s%s%s')", static_cast<void *>(this), m_arch.GetArchitectureName(),
+                    m_file.GetPath().c_str(), m_object_name.IsEmpty() ? "" : "(",
+                    m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""), m_object_name.IsEmpty() ? "" : ")");
+}
+
+Module::Module()
+    : m_mutex(),
+      m_mod_time(),
+      m_arch(),
+      m_uuid(),
+      m_file(),
+      m_platform_file(),
+      m_remote_install_file(),
+      m_symfile_spec(),
+      m_object_name(),
+      m_object_offset(0),
+      m_object_mod_time(),
+      m_objfile_sp(),
+      m_symfile_ap(),
+      m_type_system_map(),
+      m_source_mappings(),
+      m_sections_ap(),
+      m_did_load_objfile(false),
+      m_did_load_symbol_vendor(false),
+      m_did_parse_uuid(false),
+      m_file_has_changed(false),
+      m_first_file_changed_log(false)
 {
-    Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
     GetModuleCollection().push_back(this);
 }
 
@@ -319,10 +310,10 @@ Module::~Module()
 {
     // Lock our module down while we tear everything down to make sure
     // we don't get any access to the module while it is being destroyed
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     // Scope for locker below...
     {
-        Mutex::Locker locker (GetAllocationModuleCollectionMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetAllocationModuleCollectionMutex());
         ModuleCollection &modules = GetModuleCollection();
         ModuleCollection::iterator end = modules.end();
         ModuleCollection::iterator pos = std::find(modules.begin(), end, this);
@@ -357,7 +348,7 @@ Module::GetMemoryObjectFile (const lldb:
     }
     else
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         if (process_sp)
         {
             m_did_load_objfile = true;
@@ -405,7 +396,7 @@ Module::GetUUID()
 {
     if (!m_did_parse_uuid.load())
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         if (!m_did_parse_uuid.load())
         {
             ObjectFile * obj_file = GetObjectFile ();
@@ -429,7 +420,7 @@ Module::GetTypeSystemForLanguage (Langua
 void
 Module::ParseAllDebugSymbols()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     size_t num_comp_units = GetNumCompileUnits();
     if (num_comp_units == 0)
         return;
@@ -484,7 +475,7 @@ Module::DumpSymbolContext(Stream *s)
 size_t
 Module::GetNumCompileUnits()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     Timer scoped_timer(__PRETTY_FUNCTION__,
                        "Module::GetNumCompileUnits (module = %p)",
                        static_cast<void*>(this));
@@ -497,7 +488,7 @@ Module::GetNumCompileUnits()
 CompUnitSP
 Module::GetCompileUnitAtIndex (size_t index)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     size_t num_comp_units = GetNumCompileUnits ();
     CompUnitSP cu_sp;
 
@@ -513,7 +504,7 @@ Module::GetCompileUnitAtIndex (size_t in
 bool
 Module::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     Timer scoped_timer(__PRETTY_FUNCTION__, "Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")", vm_addr);
     SectionList *section_list = GetSectionList();
     if (section_list)
@@ -525,7 +516,7 @@ uint32_t
 Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc,
                                         bool resolve_tail_call_address)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     uint32_t resolved_flags = 0;
 
     // Clear the result symbol context in case we don't find anything, but don't clear the target
@@ -675,7 +666,7 @@ Module::ResolveSymbolContextForFilePath
 uint32_t
 Module::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     Timer scoped_timer(__PRETTY_FUNCTION__,
                        "Module::ResolveSymbolContextForFilePath (%s:%u, check_inlines = %s, resolve_scope = 0x%8.8x)",
                        file_spec.GetPath().c_str(),
@@ -1037,7 +1028,7 @@ Module::GetSymbolVendor (bool can_create
 {
     if (!m_did_load_symbol_vendor.load())
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         if (!m_did_load_symbol_vendor.load() && can_create)
         {
             ObjectFile *obj_file = GetObjectFile ();
@@ -1084,7 +1075,7 @@ Module::GetSpecificationDescription () c
 void
 Module::GetDescription (Stream *s, lldb::DescriptionLevel level)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (level >= eDescriptionLevelFull)
     {
@@ -1245,7 +1236,7 @@ Module::LogMessageVerboseBacktrace (Log
 void
 Module::Dump(Stream *s)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     //s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
     s->Indent();
     s->Printf("Module %s%s%s%s\n",
@@ -1287,7 +1278,7 @@ Module::GetObjectFile()
 {
     if (!m_did_load_objfile.load())
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         if (!m_did_load_objfile.load())
         {
             Timer scoped_timer(__PRETTY_FUNCTION__,
@@ -1710,14 +1701,14 @@ Module::MatchesModuleSpec (const ModuleS
 bool
 Module::FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_source_mappings.FindFile (orig_spec, new_spec);
 }
 
 bool
 Module::RemapSourceFile (const char *path, std::string &new_path) const
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_source_mappings.RemapPath(path, new_path);
 }
 

Modified: lldb/trunk/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/PluginManager.cpp (original)
+++ lldb/trunk/source/Core/PluginManager.cpp Tue May 17 20:59:10 2016
@@ -12,6 +12,7 @@
 // C Includes
 // C++ Includes
 #include <climits>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -25,7 +26,6 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 
 using namespace lldb;
@@ -55,10 +55,10 @@ struct PluginInfo
 
 typedef std::map<FileSpec, PluginInfo> PluginTerminateMap;
 
-static Mutex &
-GetPluginMapMutex ()
+static std::recursive_mutex &
+GetPluginMapMutex()
 {
-    static Mutex g_plugin_map_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_plugin_map_mutex;
     return g_plugin_map_mutex;
 }
 
@@ -72,7 +72,7 @@ GetPluginMap ()
 static bool
 PluginIsLoaded (const FileSpec &plugin_file_spec)
 {
-    Mutex::Locker locker (GetPluginMapMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
     PluginTerminateMap &plugin_map = GetPluginMap ();
     return plugin_map.find (plugin_file_spec) != plugin_map.end();
 }
@@ -80,7 +80,7 @@ PluginIsLoaded (const FileSpec &plugin_f
 static void
 SetPluginInfo (const FileSpec &plugin_file_spec, const PluginInfo &plugin_info)
 {
-    Mutex::Locker locker (GetPluginMapMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
     PluginTerminateMap &plugin_map = GetPluginMap ();
     assert (plugin_map.find (plugin_file_spec) == plugin_map.end());
     plugin_map[plugin_file_spec] = plugin_info;
@@ -209,7 +209,7 @@ PluginManager::Initialize ()
 void
 PluginManager::Terminate ()
 {
-    Mutex::Locker locker (GetPluginMapMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
     PluginTerminateMap &plugin_map = GetPluginMap ();
     
     PluginTerminateMap::const_iterator pos, end = plugin_map.end();
@@ -244,10 +244,10 @@ struct ABIInstance
 
 typedef std::vector<ABIInstance> ABIInstances;
 
-static Mutex &
-GetABIInstancesMutex ()
+static std::recursive_mutex &
+GetABIInstancesMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -271,7 +271,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetABIInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetABIInstancesMutex());
         GetABIInstances ().push_back (instance);
         return true;
     }
@@ -283,7 +283,7 @@ PluginManager::UnregisterPlugin (ABICrea
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetABIInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetABIInstancesMutex());
         ABIInstances &instances = GetABIInstances ();
 
         ABIInstances::iterator pos, end = instances.end();
@@ -302,7 +302,7 @@ PluginManager::UnregisterPlugin (ABICrea
 ABICreateInstance
 PluginManager::GetABICreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetABIInstancesMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetABIInstancesMutex());
     ABIInstances &instances = GetABIInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -314,7 +314,7 @@ PluginManager::GetABICreateCallbackForPl
 {
     if (name)
     {
-        Mutex::Locker locker (GetABIInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetABIInstancesMutex());
         ABIInstances &instances = GetABIInstances ();
 
         ABIInstances::iterator pos, end = instances.end();
@@ -345,10 +345,10 @@ struct DisassemblerInstance
 
 typedef std::vector<DisassemblerInstance> DisassemblerInstances;
 
-static Mutex &
-GetDisassemblerMutex ()
+static std::recursive_mutex &
+GetDisassemblerMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -372,7 +372,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetDisassemblerMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDisassemblerMutex());
         GetDisassemblerInstances ().push_back (instance);
         return true;
     }
@@ -384,7 +384,7 @@ PluginManager::UnregisterPlugin (Disasse
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetDisassemblerMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDisassemblerMutex());
         DisassemblerInstances &instances = GetDisassemblerInstances ();
         
         DisassemblerInstances::iterator pos, end = instances.end();
@@ -403,7 +403,7 @@ PluginManager::UnregisterPlugin (Disasse
 DisassemblerCreateInstance
 PluginManager::GetDisassemblerCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetDisassemblerMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetDisassemblerMutex());
     DisassemblerInstances &instances = GetDisassemblerInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -415,7 +415,7 @@ PluginManager::GetDisassemblerCreateCall
 {
     if (name)
     {
-        Mutex::Locker locker (GetDisassemblerMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDisassemblerMutex());
         DisassemblerInstances &instances = GetDisassemblerInstances ();
         
         DisassemblerInstances::iterator pos, end = instances.end();
@@ -448,10 +448,10 @@ struct DynamicLoaderInstance
 
 typedef std::vector<DynamicLoaderInstance> DynamicLoaderInstances;
 
-static Mutex &
-GetDynamicLoaderMutex ()
+static std::recursive_mutex &
+GetDynamicLoaderMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -477,7 +477,7 @@ PluginManager::RegisterPlugin(const Cons
             instance.description = description;
         instance.create_callback = create_callback;
         instance.debugger_init_callback = debugger_init_callback;
-        Mutex::Locker locker (GetDynamicLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDynamicLoaderMutex());
         GetDynamicLoaderInstances ().push_back (instance);
     }
     return false;
@@ -488,7 +488,7 @@ PluginManager::UnregisterPlugin (Dynamic
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetDynamicLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDynamicLoaderMutex());
         DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
         
         DynamicLoaderInstances::iterator pos, end = instances.end();
@@ -507,7 +507,7 @@ PluginManager::UnregisterPlugin (Dynamic
 DynamicLoaderCreateInstance
 PluginManager::GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetDynamicLoaderMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetDynamicLoaderMutex());
     DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -519,7 +519,7 @@ PluginManager::GetDynamicLoaderCreateCal
 {
     if (name)
     {
-        Mutex::Locker locker (GetDynamicLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDynamicLoaderMutex());
         DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
         
         DynamicLoaderInstances::iterator pos, end = instances.end();
@@ -552,10 +552,10 @@ struct JITLoaderInstance
 
 typedef std::vector<JITLoaderInstance> JITLoaderInstances;
 
-static Mutex &
-GetJITLoaderMutex ()
+static std::recursive_mutex &
+GetJITLoaderMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -581,7 +581,7 @@ PluginManager::RegisterPlugin(const Cons
             instance.description = description;
         instance.create_callback = create_callback;
         instance.debugger_init_callback = debugger_init_callback;
-        Mutex::Locker locker (GetJITLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
         GetJITLoaderInstances ().push_back (instance);
     }
     return false;
@@ -592,7 +592,7 @@ PluginManager::UnregisterPlugin (JITLoad
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetJITLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
         JITLoaderInstances &instances = GetJITLoaderInstances ();
         
         JITLoaderInstances::iterator pos, end = instances.end();
@@ -611,7 +611,7 @@ PluginManager::UnregisterPlugin (JITLoad
 JITLoaderCreateInstance
 PluginManager::GetJITLoaderCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetJITLoaderMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
     JITLoaderInstances &instances = GetJITLoaderInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -623,7 +623,7 @@ PluginManager::GetJITLoaderCreateCallbac
 {
     if (name)
     {
-        Mutex::Locker locker (GetJITLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
         JITLoaderInstances &instances = GetJITLoaderInstances ();
         
         JITLoaderInstances::iterator pos, end = instances.end();
@@ -654,10 +654,10 @@ struct EmulateInstructionInstance
 
 typedef std::vector<EmulateInstructionInstance> EmulateInstructionInstances;
 
-static Mutex &
-GetEmulateInstructionMutex ()
+static std::recursive_mutex &
+GetEmulateInstructionMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -681,7 +681,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetEmulateInstructionMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetEmulateInstructionMutex());
         GetEmulateInstructionInstances ().push_back (instance);
     }
     return false;
@@ -692,7 +692,7 @@ PluginManager::UnregisterPlugin (Emulate
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetEmulateInstructionMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetEmulateInstructionMutex());
         EmulateInstructionInstances &instances = GetEmulateInstructionInstances ();
         
         EmulateInstructionInstances::iterator pos, end = instances.end();
@@ -711,7 +711,7 @@ PluginManager::UnregisterPlugin (Emulate
 EmulateInstructionCreateInstance
 PluginManager::GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetEmulateInstructionMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetEmulateInstructionMutex());
     EmulateInstructionInstances &instances = GetEmulateInstructionInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -723,7 +723,7 @@ PluginManager::GetEmulateInstructionCrea
 {
     if (name)
     {
-        Mutex::Locker locker (GetEmulateInstructionMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetEmulateInstructionMutex());
         EmulateInstructionInstances &instances = GetEmulateInstructionInstances ();
         
         EmulateInstructionInstances::iterator pos, end = instances.end();
@@ -756,10 +756,10 @@ struct OperatingSystemInstance
 
 typedef std::vector<OperatingSystemInstance> OperatingSystemInstances;
 
-static Mutex &
-GetOperatingSystemMutex ()
+static std::recursive_mutex &
+GetOperatingSystemMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -784,7 +784,7 @@ PluginManager::RegisterPlugin(const Cons
             instance.description = description;
         instance.create_callback = create_callback;
         instance.debugger_init_callback = debugger_init_callback;
-        Mutex::Locker locker (GetOperatingSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetOperatingSystemMutex());
         GetOperatingSystemInstances ().push_back (instance);
     }
     return false;
@@ -795,7 +795,7 @@ PluginManager::UnregisterPlugin (Operati
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetOperatingSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetOperatingSystemMutex());
         OperatingSystemInstances &instances = GetOperatingSystemInstances ();
         
         OperatingSystemInstances::iterator pos, end = instances.end();
@@ -814,7 +814,7 @@ PluginManager::UnregisterPlugin (Operati
 OperatingSystemCreateInstance
 PluginManager::GetOperatingSystemCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetOperatingSystemMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetOperatingSystemMutex());
     OperatingSystemInstances &instances = GetOperatingSystemInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -826,7 +826,7 @@ PluginManager::GetOperatingSystemCreateC
 {
     if (name)
     {
-        Mutex::Locker locker (GetOperatingSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetOperatingSystemMutex());
         OperatingSystemInstances &instances = GetOperatingSystemInstances ();
         
         OperatingSystemInstances::iterator pos, end = instances.end();
@@ -857,10 +857,10 @@ struct LanguageInstance
 
 typedef std::vector<LanguageInstance> LanguageInstances;
 
-static Mutex &
-GetLanguageMutex ()
+static std::recursive_mutex &
+GetLanguageMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -884,7 +884,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetLanguageMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetLanguageMutex());
         GetLanguageInstances ().push_back (instance);
     }
     return false;
@@ -895,7 +895,7 @@ PluginManager::UnregisterPlugin (Languag
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetLanguageMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetLanguageMutex());
         LanguageInstances &instances = GetLanguageInstances ();
         
         LanguageInstances::iterator pos, end = instances.end();
@@ -914,7 +914,7 @@ PluginManager::UnregisterPlugin (Languag
 LanguageCreateInstance
 PluginManager::GetLanguageCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetLanguageMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetLanguageMutex());
     LanguageInstances &instances = GetLanguageInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -926,7 +926,7 @@ PluginManager::GetLanguageCreateCallback
 {
     if (name)
     {
-        Mutex::Locker locker (GetLanguageMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetLanguageMutex());
         LanguageInstances &instances = GetLanguageInstances ();
         
         LanguageInstances::iterator pos, end = instances.end();
@@ -958,10 +958,10 @@ struct LanguageRuntimeInstance
 
 typedef std::vector<LanguageRuntimeInstance> LanguageRuntimeInstances;
 
-static Mutex &
-GetLanguageRuntimeMutex ()
+static std::recursive_mutex &
+GetLanguageRuntimeMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -987,7 +987,7 @@ PluginManager::RegisterPlugin(const Cons
             instance.description = description;
         instance.create_callback = create_callback;
         instance.command_callback = command_callback;
-        Mutex::Locker locker (GetLanguageRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
         GetLanguageRuntimeInstances ().push_back (instance);
     }
     return false;
@@ -998,7 +998,7 @@ PluginManager::UnregisterPlugin (Languag
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetLanguageRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
         LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
         
         LanguageRuntimeInstances::iterator pos, end = instances.end();
@@ -1017,7 +1017,7 @@ PluginManager::UnregisterPlugin (Languag
 LanguageRuntimeCreateInstance
 PluginManager::GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetLanguageRuntimeMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
     LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1027,7 +1027,7 @@ PluginManager::GetLanguageRuntimeCreateC
 LanguageRuntimeGetCommandObject
 PluginManager::GetLanguageRuntimeGetCommandObjectAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetLanguageRuntimeMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
     LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
     if (idx < instances.size())
         return instances[idx].command_callback;
@@ -1039,7 +1039,7 @@ PluginManager::GetLanguageRuntimeCreateC
 {
     if (name)
     {
-        Mutex::Locker locker (GetLanguageRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetLanguageRuntimeMutex());
         LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
         
         LanguageRuntimeInstances::iterator pos, end = instances.end();
@@ -1070,10 +1070,10 @@ struct SystemRuntimeInstance
 
 typedef std::vector<SystemRuntimeInstance> SystemRuntimeInstances;
 
-static Mutex &
-GetSystemRuntimeMutex ()
+static std::recursive_mutex &
+GetSystemRuntimeMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1097,7 +1097,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetSystemRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSystemRuntimeMutex());
         GetSystemRuntimeInstances ().push_back (instance);
     }
     return false;
@@ -1108,7 +1108,7 @@ PluginManager::UnregisterPlugin (SystemR
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetSystemRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSystemRuntimeMutex());
         SystemRuntimeInstances &instances = GetSystemRuntimeInstances ();
         
         SystemRuntimeInstances::iterator pos, end = instances.end();
@@ -1127,7 +1127,7 @@ PluginManager::UnregisterPlugin (SystemR
 SystemRuntimeCreateInstance
 PluginManager::GetSystemRuntimeCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetSystemRuntimeMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetSystemRuntimeMutex());
     SystemRuntimeInstances &instances = GetSystemRuntimeInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1139,7 +1139,7 @@ PluginManager::GetSystemRuntimeCreateCal
 {
     if (name)
     {
-        Mutex::Locker locker (GetSystemRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSystemRuntimeMutex());
         SystemRuntimeInstances &instances = GetSystemRuntimeInstances ();
         
         SystemRuntimeInstances::iterator pos, end = instances.end();
@@ -1176,10 +1176,10 @@ struct ObjectFileInstance
 
 typedef std::vector<ObjectFileInstance> ObjectFileInstances;
 
-static Mutex &
-GetObjectFileMutex ()
+static std::recursive_mutex &
+GetObjectFileMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1209,7 +1209,7 @@ PluginManager::RegisterPlugin (const Con
         instance.create_memory_callback = create_memory_callback;
         instance.save_core = save_core;
         instance.get_module_specifications = get_module_specifications;
-        Mutex::Locker locker (GetObjectFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
         GetObjectFileInstances ().push_back (instance);
     }
     return false;
@@ -1220,7 +1220,7 @@ PluginManager::UnregisterPlugin (ObjectF
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetObjectFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
         ObjectFileInstances &instances = GetObjectFileInstances ();
         
         ObjectFileInstances::iterator pos, end = instances.end();
@@ -1239,7 +1239,7 @@ PluginManager::UnregisterPlugin (ObjectF
 ObjectFileCreateInstance
 PluginManager::GetObjectFileCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetObjectFileMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
     ObjectFileInstances &instances = GetObjectFileInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1249,7 +1249,7 @@ PluginManager::GetObjectFileCreateCallba
 ObjectFileCreateMemoryInstance
 PluginManager::GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetObjectFileMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
     ObjectFileInstances &instances = GetObjectFileInstances ();
     if (idx < instances.size())
         return instances[idx].create_memory_callback;
@@ -1259,7 +1259,7 @@ PluginManager::GetObjectFileCreateMemory
 ObjectFileGetModuleSpecifications
 PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetObjectFileMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
     ObjectFileInstances &instances = GetObjectFileInstances ();
     if (idx < instances.size())
         return instances[idx].get_module_specifications;
@@ -1271,7 +1271,7 @@ PluginManager::GetObjectFileCreateCallba
 {
     if (name)
     {
-        Mutex::Locker locker (GetObjectFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
         ObjectFileInstances &instances = GetObjectFileInstances ();
         
         ObjectFileInstances::iterator pos, end = instances.end();
@@ -1289,7 +1289,7 @@ PluginManager::GetObjectFileCreateMemory
 {
     if (name)
     {
-        Mutex::Locker locker (GetObjectFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
         ObjectFileInstances &instances = GetObjectFileInstances ();
         
         ObjectFileInstances::iterator pos, end = instances.end();
@@ -1306,7 +1306,7 @@ Error
 PluginManager::SaveCore (const lldb::ProcessSP &process_sp, const FileSpec &outfile)
 {
     Error error;
-    Mutex::Locker locker (GetObjectFileMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectFileMutex());
     ObjectFileInstances &instances = GetObjectFileInstances ();
     
     ObjectFileInstances::iterator pos, end = instances.end();
@@ -1339,10 +1339,10 @@ struct ObjectContainerInstance
 
 typedef std::vector<ObjectContainerInstance> ObjectContainerInstances;
 
-static Mutex &
-GetObjectContainerMutex ()
+static std::recursive_mutex &
+GetObjectContainerMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1368,7 +1368,7 @@ PluginManager::RegisterPlugin (const Con
             instance.description = description;
         instance.create_callback = create_callback;
         instance.get_module_specifications = get_module_specifications;
-        Mutex::Locker locker (GetObjectContainerMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
         GetObjectContainerInstances ().push_back (instance);
     }
     return false;
@@ -1379,7 +1379,7 @@ PluginManager::UnregisterPlugin (ObjectC
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetObjectContainerMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
         ObjectContainerInstances &instances = GetObjectContainerInstances ();
         
         ObjectContainerInstances::iterator pos, end = instances.end();
@@ -1398,7 +1398,7 @@ PluginManager::UnregisterPlugin (ObjectC
 ObjectContainerCreateInstance
 PluginManager::GetObjectContainerCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetObjectContainerMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
     ObjectContainerInstances &instances = GetObjectContainerInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1410,7 +1410,7 @@ PluginManager::GetObjectContainerCreateC
 {
     if (name)
     {
-        Mutex::Locker locker (GetObjectContainerMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
         ObjectContainerInstances &instances = GetObjectContainerInstances ();
         
         ObjectContainerInstances::iterator pos, end = instances.end();
@@ -1426,7 +1426,7 @@ PluginManager::GetObjectContainerCreateC
 ObjectFileGetModuleSpecifications
 PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetObjectContainerMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectContainerMutex());
     ObjectContainerInstances &instances = GetObjectContainerInstances ();
     if (idx < instances.size())
         return instances[idx].get_module_specifications;
@@ -1451,10 +1451,10 @@ struct LogInstance
 
 typedef std::vector<LogInstance> LogInstances;
 
-static Mutex &
-GetLogMutex ()
+static std::recursive_mutex &
+GetLogMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1478,7 +1478,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetLogMutex ());
+        std::lock_guard<std::recursive_mutex> gard(GetLogMutex());
         GetLogInstances ().push_back (instance);
     }
     return false;
@@ -1489,7 +1489,7 @@ PluginManager::UnregisterPlugin (LogChan
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetLogMutex ());
+        std::lock_guard<std::recursive_mutex> gard(GetLogMutex());
         LogInstances &instances = GetLogInstances ();
         
         LogInstances::iterator pos, end = instances.end();
@@ -1508,7 +1508,7 @@ PluginManager::UnregisterPlugin (LogChan
 const char *
 PluginManager::GetLogChannelCreateNameAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetLogMutex ());
+    std::lock_guard<std::recursive_mutex> gard(GetLogMutex());
     LogInstances &instances = GetLogInstances ();
     if (idx < instances.size())
         return instances[idx].name.GetCString();
@@ -1518,7 +1518,7 @@ PluginManager::GetLogChannelCreateNameAt
 LogChannelCreateInstance
 PluginManager::GetLogChannelCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetLogMutex ());
+    std::lock_guard<std::recursive_mutex> gard(GetLogMutex());
     LogInstances &instances = GetLogInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1530,7 +1530,7 @@ PluginManager::GetLogChannelCreateCallba
 {
     if (name)
     {
-        Mutex::Locker locker (GetLogMutex ());
+        std::lock_guard<std::recursive_mutex> gard(GetLogMutex());
         LogInstances &instances = GetLogInstances ();
         
         LogInstances::iterator pos, end = instances.end();
@@ -1563,10 +1563,10 @@ struct PlatformInstance
 
 typedef std::vector<PlatformInstance> PlatformInstances;
 
-static Mutex &
-GetPlatformInstancesMutex ()
+static std::recursive_mutex &
+GetPlatformInstancesMutex()
 {
-    static Mutex g_platform_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_platform_instances_mutex;
     return g_platform_instances_mutex;
 }
 
@@ -1585,8 +1585,8 @@ PluginManager::RegisterPlugin (const Con
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetPlatformInstancesMutex ());
-        
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
+
         PlatformInstance instance;
         assert ((bool)name);
         instance.name = name;
@@ -1603,7 +1603,7 @@ PluginManager::RegisterPlugin (const Con
 const char *
 PluginManager::GetPlatformPluginNameAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetPlatformInstancesMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
     PlatformInstances &instances = GetPlatformInstances ();
     if (idx < instances.size())
         return instances[idx].name.GetCString();
@@ -1613,7 +1613,7 @@ PluginManager::GetPlatformPluginNameAtIn
 const char *
 PluginManager::GetPlatformPluginDescriptionAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetPlatformInstancesMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
     PlatformInstances &instances = GetPlatformInstances ();
     if (idx < instances.size())
         return instances[idx].description.c_str();
@@ -1625,7 +1625,7 @@ PluginManager::UnregisterPlugin (Platfor
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetPlatformInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
         PlatformInstances &instances = GetPlatformInstances ();
 
         PlatformInstances::iterator pos, end = instances.end();
@@ -1644,7 +1644,7 @@ PluginManager::UnregisterPlugin (Platfor
 PlatformCreateInstance
 PluginManager::GetPlatformCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetPlatformInstancesMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
     PlatformInstances &instances = GetPlatformInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1656,7 +1656,7 @@ PluginManager::GetPlatformCreateCallback
 {
     if (name)
     {
-        Mutex::Locker locker (GetPlatformInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
         PlatformInstances &instances = GetPlatformInstances ();
 
         PlatformInstances::iterator pos, end = instances.end();
@@ -1674,7 +1674,7 @@ PluginManager::AutoCompletePlatformName
 {
     if (name)
     {
-        Mutex::Locker locker (GetPlatformInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
         PlatformInstances &instances = GetPlatformInstances ();
         llvm::StringRef name_sref(name);
 
@@ -1709,10 +1709,10 @@ struct ProcessInstance
 
 typedef std::vector<ProcessInstance> ProcessInstances;
 
-static Mutex &
-GetProcessMutex ()
+static std::recursive_mutex &
+GetProcessMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1738,7 +1738,7 @@ PluginManager::RegisterPlugin (const Con
             instance.description = description;
         instance.create_callback = create_callback;
         instance.debugger_init_callback = debugger_init_callback;
-        Mutex::Locker locker (GetProcessMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
         GetProcessInstances ().push_back (instance);
     }
     return false;
@@ -1747,7 +1747,7 @@ PluginManager::RegisterPlugin (const Con
 const char *
 PluginManager::GetProcessPluginNameAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetProcessMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
     ProcessInstances &instances = GetProcessInstances ();
     if (idx < instances.size())
         return instances[idx].name.GetCString();
@@ -1757,7 +1757,7 @@ PluginManager::GetProcessPluginNameAtInd
 const char *
 PluginManager::GetProcessPluginDescriptionAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetProcessMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
     ProcessInstances &instances = GetProcessInstances ();
     if (idx < instances.size())
         return instances[idx].description.c_str();
@@ -1769,7 +1769,7 @@ PluginManager::UnregisterPlugin (Process
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetProcessMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
         ProcessInstances &instances = GetProcessInstances ();
         
         ProcessInstances::iterator pos, end = instances.end();
@@ -1788,7 +1788,7 @@ PluginManager::UnregisterPlugin (Process
 ProcessCreateInstance
 PluginManager::GetProcessCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetProcessMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
     ProcessInstances &instances = GetProcessInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1800,7 +1800,7 @@ PluginManager::GetProcessCreateCallbackF
 {
     if (name)
     {
-        Mutex::Locker locker (GetProcessMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
         ProcessInstances &instances = GetProcessInstances ();
         
         ProcessInstances::iterator pos, end = instances.end();
@@ -1833,10 +1833,10 @@ struct ScriptInterpreterInstance
 
 typedef std::vector<ScriptInterpreterInstance> ScriptInterpreterInstances;
 
-static Mutex &
+static std::recursive_mutex &
 GetScriptInterpreterMutex()
 {
-    static Mutex g_instances_mutex(Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1860,7 +1860,7 @@ PluginManager::RegisterPlugin(const Cons
         instance.description = description;
     instance.create_callback = create_callback;
     instance.language = script_language;
-    Mutex::Locker locker(GetScriptInterpreterMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetScriptInterpreterMutex());
     GetScriptInterpreterInstances().push_back(instance);
     return false;
 }
@@ -1870,7 +1870,7 @@ PluginManager::UnregisterPlugin(ScriptIn
 {
     if (!create_callback)
         return false;
-    Mutex::Locker locker(GetScriptInterpreterMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetScriptInterpreterMutex());
     ScriptInterpreterInstances &instances = GetScriptInterpreterInstances();
 
     ScriptInterpreterInstances::iterator pos, end = instances.end();
@@ -1888,7 +1888,7 @@ PluginManager::UnregisterPlugin(ScriptIn
 ScriptInterpreterCreateInstance
 PluginManager::GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx)
 {
-    Mutex::Locker locker(GetScriptInterpreterMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetScriptInterpreterMutex());
     ScriptInterpreterInstances &instances = GetScriptInterpreterInstances();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -1898,7 +1898,7 @@ PluginManager::GetScriptInterpreterCreat
 lldb::ScriptInterpreterSP
 PluginManager::GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang, CommandInterpreter &interpreter)
 {
-    Mutex::Locker locker(GetScriptInterpreterMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetScriptInterpreterMutex());
     ScriptInterpreterInstances &instances = GetScriptInterpreterInstances();
 
     ScriptInterpreterInstances::iterator pos, end = instances.end();
@@ -1937,10 +1937,10 @@ struct SymbolFileInstance
 
 typedef std::vector<SymbolFileInstance> SymbolFileInstances;
 
-static Mutex &
-GetSymbolFileMutex ()
+static std::recursive_mutex &
+GetSymbolFileMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -1966,7 +1966,7 @@ PluginManager::RegisterPlugin(const Cons
             instance.description = description;
         instance.create_callback = create_callback;
         instance.debugger_init_callback = debugger_init_callback;
-        Mutex::Locker locker (GetSymbolFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
         GetSymbolFileInstances ().push_back (instance);
     }
     return false;
@@ -1977,7 +1977,7 @@ PluginManager::UnregisterPlugin (SymbolF
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetSymbolFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
         SymbolFileInstances &instances = GetSymbolFileInstances ();
         
         SymbolFileInstances::iterator pos, end = instances.end();
@@ -1996,7 +1996,7 @@ PluginManager::UnregisterPlugin (SymbolF
 SymbolFileCreateInstance
 PluginManager::GetSymbolFileCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetSymbolFileMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
     SymbolFileInstances &instances = GetSymbolFileInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2008,7 +2008,7 @@ PluginManager::GetSymbolFileCreateCallba
 {
     if (name)
     {
-        Mutex::Locker locker (GetSymbolFileMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
         SymbolFileInstances &instances = GetSymbolFileInstances ();
         
         SymbolFileInstances::iterator pos, end = instances.end();
@@ -2039,10 +2039,10 @@ struct SymbolVendorInstance
 
 typedef std::vector<SymbolVendorInstance> SymbolVendorInstances;
 
-static Mutex &
-GetSymbolVendorMutex ()
+static std::recursive_mutex &
+GetSymbolVendorMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -2066,7 +2066,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetSymbolVendorMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolVendorMutex());
         GetSymbolVendorInstances ().push_back (instance);
     }
     return false;
@@ -2077,7 +2077,7 @@ PluginManager::UnregisterPlugin (SymbolV
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetSymbolVendorMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolVendorMutex());
         SymbolVendorInstances &instances = GetSymbolVendorInstances ();
         
         SymbolVendorInstances::iterator pos, end = instances.end();
@@ -2096,7 +2096,7 @@ PluginManager::UnregisterPlugin (SymbolV
 SymbolVendorCreateInstance
 PluginManager::GetSymbolVendorCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetSymbolVendorMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetSymbolVendorMutex());
     SymbolVendorInstances &instances = GetSymbolVendorInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2108,7 +2108,7 @@ PluginManager::GetSymbolVendorCreateCall
 {
     if (name)
     {
-        Mutex::Locker locker (GetSymbolVendorMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolVendorMutex());
         SymbolVendorInstances &instances = GetSymbolVendorInstances ();
         
         SymbolVendorInstances::iterator pos, end = instances.end();
@@ -2139,10 +2139,10 @@ struct UnwindAssemblyInstance
 
 typedef std::vector<UnwindAssemblyInstance> UnwindAssemblyInstances;
 
-static Mutex &
-GetUnwindAssemblyMutex ()
+static std::recursive_mutex &
+GetUnwindAssemblyMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -2166,7 +2166,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetUnwindAssemblyMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetUnwindAssemblyMutex());
         GetUnwindAssemblyInstances ().push_back (instance);
     }
     return false;
@@ -2177,7 +2177,7 @@ PluginManager::UnregisterPlugin (UnwindA
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetUnwindAssemblyMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetUnwindAssemblyMutex());
         UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances ();
         
         UnwindAssemblyInstances::iterator pos, end = instances.end();
@@ -2196,7 +2196,7 @@ PluginManager::UnregisterPlugin (UnwindA
 UnwindAssemblyCreateInstance
 PluginManager::GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetUnwindAssemblyMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetUnwindAssemblyMutex());
     UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2208,7 +2208,7 @@ PluginManager::GetUnwindAssemblyCreateCa
 {
     if (name)
     {
-        Mutex::Locker locker (GetUnwindAssemblyMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetUnwindAssemblyMutex());
         UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances ();
         
         UnwindAssemblyInstances::iterator pos, end = instances.end();
@@ -2239,10 +2239,10 @@ struct MemoryHistoryInstance
 
 typedef std::vector<MemoryHistoryInstance> MemoryHistoryInstances;
 
-static Mutex &
-GetMemoryHistoryMutex ()
+static std::recursive_mutex &
+GetMemoryHistoryMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -2266,7 +2266,7 @@ PluginManager::RegisterPlugin(const Cons
         if (description && description[0])
             instance.description = description;
         instance.create_callback = create_callback;
-        Mutex::Locker locker (GetMemoryHistoryMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetMemoryHistoryMutex());
         GetMemoryHistoryInstances ().push_back (instance);
     }
     return false;
@@ -2277,7 +2277,7 @@ PluginManager::UnregisterPlugin (MemoryH
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetMemoryHistoryMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetMemoryHistoryMutex());
         MemoryHistoryInstances &instances = GetMemoryHistoryInstances ();
         
         MemoryHistoryInstances::iterator pos, end = instances.end();
@@ -2296,7 +2296,7 @@ PluginManager::UnregisterPlugin (MemoryH
 MemoryHistoryCreateInstance
 PluginManager::GetMemoryHistoryCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetMemoryHistoryMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetMemoryHistoryMutex());
     MemoryHistoryInstances &instances = GetMemoryHistoryInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2308,7 +2308,7 @@ PluginManager::GetMemoryHistoryCreateCal
 {
     if (name)
     {
-        Mutex::Locker locker (GetMemoryHistoryMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetMemoryHistoryMutex());
         MemoryHistoryInstances &instances = GetMemoryHistoryInstances ();
         
         MemoryHistoryInstances::iterator pos, end = instances.end();
@@ -2340,10 +2340,10 @@ struct InstrumentationRuntimeInstance
 
 typedef std::vector<InstrumentationRuntimeInstance> InstrumentationRuntimeInstances;
 
-static Mutex &
-GetInstrumentationRuntimeMutex ()
+static std::recursive_mutex &
+GetInstrumentationRuntimeMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -2369,7 +2369,7 @@ PluginManager::RegisterPlugin(const Cons
             instance.description = description;
         instance.create_callback = create_callback;
         instance.get_type_callback = get_type_callback;
-        Mutex::Locker locker (GetInstrumentationRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetInstrumentationRuntimeMutex());
         GetInstrumentationRuntimeInstances ().push_back (instance);
     }
     return false;
@@ -2380,7 +2380,7 @@ PluginManager::UnregisterPlugin (Instrum
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetInstrumentationRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetInstrumentationRuntimeMutex());
         InstrumentationRuntimeInstances &instances = GetInstrumentationRuntimeInstances ();
         
         InstrumentationRuntimeInstances::iterator pos, end = instances.end();
@@ -2399,7 +2399,7 @@ PluginManager::UnregisterPlugin (Instrum
 InstrumentationRuntimeGetType
 PluginManager::GetInstrumentationRuntimeGetTypeCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetInstrumentationRuntimeMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetInstrumentationRuntimeMutex());
     InstrumentationRuntimeInstances &instances = GetInstrumentationRuntimeInstances ();
     if (idx < instances.size())
         return instances[idx].get_type_callback;
@@ -2409,7 +2409,7 @@ PluginManager::GetInstrumentationRuntime
 InstrumentationRuntimeCreateInstance
 PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetInstrumentationRuntimeMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetInstrumentationRuntimeMutex());
     InstrumentationRuntimeInstances &instances = GetInstrumentationRuntimeInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2421,7 +2421,7 @@ PluginManager::GetInstrumentationRuntime
 {
     if (name)
     {
-        Mutex::Locker locker (GetInstrumentationRuntimeMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetInstrumentationRuntimeMutex());
         InstrumentationRuntimeInstances &instances = GetInstrumentationRuntimeInstances ();
         
         InstrumentationRuntimeInstances::iterator pos, end = instances.end();
@@ -2453,10 +2453,10 @@ struct TypeSystemInstance
 
 typedef std::vector<TypeSystemInstance> TypeSystemInstances;
 
-static Mutex &
-GetTypeSystemMutex ()
+static std::recursive_mutex &
+GetTypeSystemMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -2482,7 +2482,7 @@ PluginManager::RegisterPlugin (const Con
             instance.description = description;
         instance.create_callback = create_callback;
         instance.enumerate_callback = enumerate_supported_languages_callback;
-        Mutex::Locker locker (GetTypeSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
         GetTypeSystemInstances ().push_back (instance);
     }
     return false;
@@ -2493,7 +2493,7 @@ PluginManager::UnregisterPlugin (TypeSys
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetTypeSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
         TypeSystemInstances &instances = GetTypeSystemInstances ();
 
         TypeSystemInstances::iterator pos, end = instances.end();
@@ -2512,7 +2512,7 @@ PluginManager::UnregisterPlugin (TypeSys
 TypeSystemCreateInstance
 PluginManager::GetTypeSystemCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetTypeSystemMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
     TypeSystemInstances &instances = GetTypeSystemInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2524,7 +2524,7 @@ PluginManager::GetTypeSystemCreateCallba
 {
     if (name)
     {
-        Mutex::Locker locker (GetTypeSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
         TypeSystemInstances &instances = GetTypeSystemInstances ();
 
         TypeSystemInstances::iterator pos, end = instances.end();
@@ -2540,7 +2540,7 @@ PluginManager::GetTypeSystemCreateCallba
 TypeSystemEnumerateSupportedLanguages
 PluginManager::GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetTypeSystemMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
     TypeSystemInstances &instances = GetTypeSystemInstances ();
     if (idx < instances.size())
         return instances[idx].enumerate_callback;
@@ -2552,7 +2552,7 @@ PluginManager::GetTypeSystemEnumerateSup
 {
     if (name)
     {
-        Mutex::Locker locker (GetTypeSystemMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetTypeSystemMutex());
         TypeSystemInstances &instances = GetTypeSystemInstances ();
         
         TypeSystemInstances::iterator pos, end = instances.end();
@@ -2584,10 +2584,10 @@ struct REPLInstance
 
 typedef std::vector<REPLInstance> REPLInstances;
 
-static Mutex &
-GetREPLMutex ()
+static std::recursive_mutex &
+GetREPLMutex()
 {
-    static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_instances_mutex;
     return g_instances_mutex;
 }
 
@@ -2613,7 +2613,7 @@ PluginManager::RegisterPlugin (const Con
             instance.description = description;
         instance.create_callback = create_callback;
         instance.enumerate_languages_callback = enumerate_languages_callback;
-        Mutex::Locker locker (GetREPLMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
         GetREPLInstances ().push_back (instance);
     }
     return false;
@@ -2624,7 +2624,7 @@ PluginManager::UnregisterPlugin (REPLCre
 {
     if (create_callback)
     {
-        Mutex::Locker locker (GetREPLMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
         REPLInstances &instances = GetREPLInstances ();
         
         REPLInstances::iterator pos, end = instances.end();
@@ -2643,7 +2643,7 @@ PluginManager::UnregisterPlugin (REPLCre
 REPLCreateInstance
 PluginManager::GetREPLCreateCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetREPLMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
     REPLInstances &instances = GetREPLInstances ();
     if (idx < instances.size())
         return instances[idx].create_callback;
@@ -2655,7 +2655,7 @@ PluginManager::GetREPLCreateCallbackForP
 {
     if (name)
     {
-        Mutex::Locker locker (GetREPLMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
         REPLInstances &instances = GetREPLInstances ();
         
         REPLInstances::iterator pos, end = instances.end();
@@ -2671,7 +2671,7 @@ PluginManager::GetREPLCreateCallbackForP
 REPLEnumerateSupportedLanguages
 PluginManager::GetREPLEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (GetREPLMutex ());
+    std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
     REPLInstances &instances = GetREPLInstances ();
     if (idx < instances.size())
         return instances[idx].enumerate_languages_callback;
@@ -2683,7 +2683,7 @@ PluginManager::GetREPLSystemEnumerateSup
 {
     if (name)
     {
-        Mutex::Locker locker (GetREPLMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetREPLMutex());
         REPLInstances &instances = GetREPLInstances ();
         
         REPLInstances::iterator pos, end = instances.end();
@@ -2703,7 +2703,7 @@ PluginManager::DebuggerInitialize (Debug
 {
     // Initialize the DynamicLoader plugins
     {
-        Mutex::Locker locker (GetDynamicLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetDynamicLoaderMutex());
         DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
     
         DynamicLoaderInstances::iterator pos, end = instances.end();
@@ -2716,7 +2716,7 @@ PluginManager::DebuggerInitialize (Debug
 
     // Initialize the JITLoader plugins
     {
-        Mutex::Locker locker (GetJITLoaderMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetJITLoaderMutex());
         JITLoaderInstances &instances = GetJITLoaderInstances ();
     
         JITLoaderInstances::iterator pos, end = instances.end();
@@ -2729,7 +2729,7 @@ PluginManager::DebuggerInitialize (Debug
 
     // Initialize the Platform plugins
     {
-        Mutex::Locker locker (GetPlatformInstancesMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformInstancesMutex());
         PlatformInstances &instances = GetPlatformInstances ();
     
         PlatformInstances::iterator pos, end = instances.end();
@@ -2742,7 +2742,7 @@ PluginManager::DebuggerInitialize (Debug
 
     // Initialize the Process plugins
     {
-        Mutex::Locker locker (GetProcessMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetProcessMutex());
         ProcessInstances &instances = GetProcessInstances();
         
         ProcessInstances::iterator pos, end = instances.end();
@@ -2755,7 +2755,7 @@ PluginManager::DebuggerInitialize (Debug
 
     // Initialize the SymbolFile plugins
     {
-        Mutex::Locker locker (GetSymbolFileMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetSymbolFileMutex());
         for (auto& sym_file: GetSymbolFileInstances())
         {
             if (sym_file.debugger_init_callback)
@@ -2765,7 +2765,7 @@ PluginManager::DebuggerInitialize (Debug
 
     // Initialize the OperatingSystem plugins
     {
-        Mutex::Locker locker(GetOperatingSystemMutex());
+        std::lock_guard<std::recursive_mutex> guard(GetOperatingSystemMutex());
         for (auto &os : GetOperatingSystemInstances())
         {
             if (os.debugger_init_callback)

Modified: lldb/trunk/source/Core/StreamCallback.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StreamCallback.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/StreamCallback.cpp (original)
+++ lldb/trunk/source/Core/StreamCallback.cpp Tue May 17 20:59:10 2016
@@ -18,13 +18,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-
-StreamCallback::StreamCallback (lldb::LogOutputCallback callback, void *baton) :
-    Stream (0, 4, eByteOrderBig),
-    m_callback (callback),
-    m_baton (baton),
-    m_accumulated_data (),
-    m_collection_mutex ()
+StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton)
+    : Stream(0, 4, eByteOrderBig), m_callback(callback), m_baton(baton), m_accumulated_data(), m_collection_mutex()
 {
 }
 
@@ -35,7 +30,7 @@ StreamCallback::~StreamCallback ()
 StreamString &
 StreamCallback::FindStreamForThread(lldb::tid_t cur_tid)
 {
-    Mutex::Locker locker(m_collection_mutex);
+    std::lock_guard<std::mutex> guard(m_collection_mutex);
     collection::iterator iter = m_accumulated_data.find (cur_tid);
     if (iter == m_accumulated_data.end())
     {

Modified: lldb/trunk/source/Core/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Timer.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Core/Timer.cpp (original)
+++ lldb/trunk/source/Core/Timer.cpp Tue May 17 20:59:10 2016
@@ -8,12 +8,12 @@
 //===----------------------------------------------------------------------===//
 #include "lldb/Core/Timer.h"
 
+#include <algorithm>
 #include <map>
+#include <mutex>
 #include <vector>
-#include <algorithm>
 
 #include "lldb/Core/Stream.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/Host.h"
 
 #include <stdio.h>
@@ -52,11 +52,10 @@ GetFileMutex()
     return *g_file_mutex_ptr;
 }
 
-
-static Mutex &
+static std::mutex &
 GetCategoryMutex()
 {
-    static Mutex g_category_mutex(Mutex::eMutexTypeNormal);
+    static std::mutex g_category_mutex;
     return g_category_mutex;
 }
 
@@ -169,7 +168,7 @@ Timer::~Timer()
         }
 
         // Keep total results for each category so we can dump results.
-        Mutex::Locker locker (GetCategoryMutex());
+        std::lock_guard<std::mutex> guard(GetCategoryMutex());
         TimerCategoryMap &category_map = GetCategoryMap();
         category_map[m_category] += timer_nsec_uint;
     }
@@ -240,7 +239,7 @@ CategoryMapIteratorSortCriterion (const
 void
 Timer::ResetCategoryTimes ()
 {
-    Mutex::Locker locker (GetCategoryMutex());
+    std::lock_guard<std::mutex> guard(GetCategoryMutex());
     TimerCategoryMap &category_map = GetCategoryMap();
     category_map.clear();
 }
@@ -248,7 +247,7 @@ Timer::ResetCategoryTimes ()
 void
 Timer::DumpCategoryTimes (Stream *s)
 {
-    Mutex::Locker locker (GetCategoryMutex());
+    std::lock_guard<std::mutex> guard(GetCategoryMutex());
     TimerCategoryMap &category_map = GetCategoryMap();
     std::vector<TimerCategoryMap::const_iterator> sorted_iterators;
     TimerCategoryMap::const_iterator pos, end = category_map.end();

Modified: lldb/trunk/source/DataFormatters/FormatCache.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatCache.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatCache.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatCache.cpp Tue May 17 20:59:10 2016
@@ -158,11 +158,13 @@ FormatCache::Entry::SetValidator (lldb::
     m_validator_sp = validator_sp;
 }
 
-FormatCache::FormatCache () :
-m_map(),
-m_mutex (Mutex::eMutexTypeRecursive)
-#ifdef LLDB_CONFIGURATION_DEBUG
-,m_cache_hits(0),m_cache_misses(0)
+FormatCache::FormatCache()
+    : m_map(),
+      m_mutex()
+#ifdef LLDB_CONFIGURATION_DEBUG
+      ,
+      m_cache_hits(0),
+      m_cache_misses(0)
 #endif
 {
 }
@@ -181,7 +183,7 @@ FormatCache::GetEntry (const ConstString
 bool
 FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     auto entry = GetEntry(type);
     if (entry.IsFormatCached())
     {
@@ -201,7 +203,7 @@ FormatCache::GetFormat (const ConstStrin
 bool
 FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     auto entry = GetEntry(type);
     if (entry.IsSummaryCached())
     {
@@ -221,7 +223,7 @@ FormatCache::GetSummary (const ConstStri
 bool
 FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     auto entry = GetEntry(type);
     if (entry.IsSyntheticCached())
     {
@@ -241,7 +243,7 @@ FormatCache::GetSynthetic (const ConstSt
 bool
 FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     auto entry = GetEntry(type);
     if (entry.IsValidatorCached())
     {
@@ -261,35 +263,35 @@ FormatCache::GetValidator (const ConstSt
 void
 FormatCache::SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     GetEntry(type).SetFormat(format_sp);
 }
 
 void
 FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     GetEntry(type).SetSummary(summary_sp);
 }
 
 void
 FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     GetEntry(type).SetSynthetic(synthetic_sp);
 }
 
 void
 FormatCache::SetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     GetEntry(type).SetValidator(validator_sp);
 }
 
 void
 FormatCache::Clear ()
 {
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_map.clear();
 }
 

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue May 17 20:59:10 2016
@@ -128,7 +128,7 @@ FormatManager::Changed ()
 {
     ++m_last_revision;
     m_format_cache.Clear ();
-    Mutex::Locker lang_locker(m_language_categories_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
     for (auto& iter : m_language_categories_map)
     {
         if (iter.second)
@@ -181,7 +181,7 @@ void
 FormatManager::EnableAllCategories ()
 {
     m_categories_map.EnableAllCategories ();
-    Mutex::Locker lang_locker(m_language_categories_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
     for (auto& iter : m_language_categories_map)
     {
         if (iter.second)
@@ -193,7 +193,7 @@ void
 FormatManager::DisableAllCategories ()
 {
     m_categories_map.DisableAllCategories ();
-    Mutex::Locker lang_locker(m_language_categories_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
     for (auto& iter : m_language_categories_map)
     {
         if (iter.second)
@@ -502,7 +502,7 @@ void
 FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback)
 {
     m_categories_map.ForEach(callback);
-    Mutex::Locker locker(m_language_categories_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
     for (const auto& entry : m_language_categories_map)
     {
         if (auto category_sp = entry.second->GetCategory())
@@ -712,7 +712,7 @@ FormatManager::GetCandidateLanguages (ll
 LanguageCategory*
 FormatManager::GetCategoryForLanguage (lldb::LanguageType lang_type)
 {
-    Mutex::Locker locker(m_language_categories_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
     auto iter = m_language_categories_map.find(lang_type), end = m_language_categories_map.end();
     if (iter != end)
         return iter->second.get();
@@ -1055,22 +1055,22 @@ FormatManager::GetHardcodedValidator (Fo
     return retval_sp;
 }
 
-FormatManager::FormatManager() :
-    m_last_revision(0),
-    m_format_cache(),
-    m_language_categories_mutex(Mutex::eMutexTypeRecursive),
-    m_language_categories_map(),
-    m_named_summaries_map(this),
-    m_categories_map(this),
-    m_default_category_name(ConstString("default")),
-    m_system_category_name(ConstString("system")), 
-    m_vectortypes_category_name(ConstString("VectorTypes"))
+FormatManager::FormatManager()
+    : m_last_revision(0),
+      m_format_cache(),
+      m_language_categories_mutex(),
+      m_language_categories_map(),
+      m_named_summaries_map(this),
+      m_categories_map(this),
+      m_default_category_name(ConstString("default")),
+      m_system_category_name(ConstString("system")),
+      m_vectortypes_category_name(ConstString("VectorTypes"))
 {
     LoadSystemFormatters();
     LoadVectorFormatters();
-    
-    EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
-    EnableCategory(m_system_category_name,TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
+
+    EnableCategory(m_vectortypes_category_name, TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
+    EnableCategory(m_system_category_name, TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
 }
 
 void

Modified: lldb/trunk/source/DataFormatters/TypeCategory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategory.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeCategory.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategory.cpp Tue May 17 20:59:10 2016
@@ -18,21 +18,20 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
-                                   ConstString name,
-                                   std::initializer_list<lldb::LanguageType> langs) :
-m_format_cont("format","regex-format",clist),
-m_summary_cont("summary","regex-summary",clist),
-m_filter_cont("filter","regex-filter",clist),
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
+                                   std::initializer_list<lldb::LanguageType> langs)
+    : m_format_cont("format", "regex-format", clist),
+      m_summary_cont("summary", "regex-summary", clist),
+      m_filter_cont("filter", "regex-filter", clist),
 #ifndef LLDB_DISABLE_PYTHON
-m_synth_cont("synth","regex-synth",clist),
+      m_synth_cont("synth", "regex-synth", clist),
 #endif
-m_validator_cont("validator","regex-validator",clist),
-m_enabled(false),
-m_change_listener(clist),
-m_mutex(Mutex::eMutexTypeRecursive),
-m_name(name),
-m_languages()
+      m_validator_cont("validator", "regex-validator", clist),
+      m_enabled(false),
+      m_change_listener(clist),
+      m_mutex(),
+      m_name(name),
+      m_languages()
 {
     for (const lldb::LanguageType lang : langs)
         AddLanguage(lang);
@@ -673,7 +672,7 @@ TypeCategoryImpl::GetTypeNameSpecifierFo
 void
 TypeCategoryImpl::Enable (bool value, uint32_t position)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if ( (m_enabled = value) )
         m_enabled_position = position;
     if (m_change_listener)

Modified: lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp Tue May 17 20:59:10 2016
@@ -20,22 +20,19 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryMap::TypeCategoryMap (IFormatChangeListener* lst) :
-m_map_mutex(Mutex::eMutexTypeRecursive),
-listener(lst),
-m_map(),
-m_active_categories()
+TypeCategoryMap::TypeCategoryMap(IFormatChangeListener *lst)
+    : m_map_mutex(), listener(lst), m_map(), m_active_categories()
 {
     ConstString default_cs("default");
     lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
-    Add(default_cs,default_sp);
-    Enable(default_cs,First);
+    Add(default_cs, default_sp);
+    Enable(default_cs, First);
 }
 
 void
 TypeCategoryMap::Add (KeyType name, const ValueSP& entry)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     m_map[name] = entry;
     if (listener)
         listener->Changed();
@@ -44,7 +41,7 @@ TypeCategoryMap::Add (KeyType name, cons
 bool
 TypeCategoryMap::Delete (KeyType name)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     MapIterator iter = m_map.find(name);
     if (iter == m_map.end())
         return false;
@@ -58,7 +55,7 @@ TypeCategoryMap::Delete (KeyType name)
 bool
 TypeCategoryMap::Enable (KeyType category_name, Position pos)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     ValueSP category;
     if (!Get(category_name,category))
         return false;
@@ -68,7 +65,7 @@ TypeCategoryMap::Enable (KeyType categor
 bool
 TypeCategoryMap::Disable (KeyType category_name)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     ValueSP category;
     if (!Get(category_name,category))
         return false;
@@ -78,7 +75,7 @@ TypeCategoryMap::Disable (KeyType catego
 bool
 TypeCategoryMap::Enable (ValueSP category, Position pos)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     if (category.get())
     {
         Position pos_w = pos;
@@ -107,7 +104,7 @@ TypeCategoryMap::Enable (ValueSP categor
 bool
 TypeCategoryMap::Disable (ValueSP category)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     if (category.get())
     {
         m_active_categories.remove_if(delete_matching_categories(category));
@@ -120,7 +117,7 @@ TypeCategoryMap::Disable (ValueSP catego
 void
 TypeCategoryMap::EnableAllCategories ()
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     std::vector<ValueSP> sorted_categories(m_map.size(), ValueSP());
     MapType::iterator iter = m_map.begin(), end = m_map.end();
     for (; iter != end; ++iter)
@@ -148,7 +145,7 @@ TypeCategoryMap::EnableAllCategories ()
 void
 TypeCategoryMap::DisableAllCategories ()
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     Position p = First;
     for (; false == m_active_categories.empty(); p++)
     {
@@ -160,7 +157,7 @@ TypeCategoryMap::DisableAllCategories ()
 void
 TypeCategoryMap::Clear ()
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     m_map.clear();
     m_active_categories.clear();
     if (listener)
@@ -170,7 +167,7 @@ TypeCategoryMap::Clear ()
 bool
 TypeCategoryMap::Get (KeyType name, ValueSP& entry)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     MapIterator iter = m_map.find(name);
     if (iter == m_map.end())
         return false;
@@ -181,7 +178,7 @@ TypeCategoryMap::Get (KeyType name, Valu
 bool
 TypeCategoryMap::Get (uint32_t pos, ValueSP& entry)
 {
-    Mutex::Locker locker(m_map_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
     MapIterator iter = m_map.begin();
     MapIterator end = m_map.end();
     while (pos > 0)
@@ -202,8 +199,8 @@ TypeCategoryMap::AnyMatches (ConstString
                              const char** matching_category,
                              TypeCategoryImpl::FormatCategoryItems* matching_type)
 {
-    Mutex::Locker locker(m_map_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
     MapIterator pos, end = m_map.end();
     for (pos = m_map.begin(); pos != end; pos++)
     {
@@ -220,8 +217,8 @@ TypeCategoryMap::AnyMatches (ConstString
 lldb::TypeFormatImplSP
 TypeCategoryMap::GetFormat (FormattersMatchData& match_data)
 {
-    Mutex::Locker locker(m_map_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
     uint32_t reason_why;
     ActiveCategoriesIterator begin, end = m_active_categories.end();
     
@@ -258,8 +255,8 @@ TypeCategoryMap::GetFormat (FormattersMa
 lldb::TypeSummaryImplSP
 TypeCategoryMap::GetSummaryFormat (FormattersMatchData& match_data)
 {
-    Mutex::Locker locker(m_map_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
     uint32_t reason_why;
     ActiveCategoriesIterator begin, end = m_active_categories.end();
     
@@ -297,8 +294,8 @@ TypeCategoryMap::GetSummaryFormat (Forma
 lldb::SyntheticChildrenSP
 TypeCategoryMap::GetSyntheticChildren (FormattersMatchData& match_data)
 {
-    Mutex::Locker locker(m_map_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
     uint32_t reason_why;
     
     ActiveCategoriesIterator begin, end = m_active_categories.end();
@@ -337,8 +334,8 @@ TypeCategoryMap::GetSyntheticChildren (F
 lldb::TypeValidatorImplSP
 TypeCategoryMap::GetValidator (FormattersMatchData& match_data)
 {
-    Mutex::Locker locker(m_map_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
     uint32_t reason_why;
     ActiveCategoriesIterator begin, end = m_active_categories.end();
     
@@ -377,8 +374,8 @@ TypeCategoryMap::ForEach(ForEachCallback
 {
     if (callback)
     {
-        Mutex::Locker locker(m_map_mutex);
-        
+        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
         // loop through enabled categories in respective order
         {
             ActiveCategoriesIterator begin, end = m_active_categories.end();
@@ -408,8 +405,8 @@ TypeCategoryMap::ForEach(ForEachCallback
 TypeCategoryImplSP
 TypeCategoryMap::GetAtIndex (uint32_t index)
 {
-    Mutex::Locker locker(m_map_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
     if (index < m_map.size())
     {
         MapIterator pos, end = m_map.end();

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Tue May 17 20:59:10 2016
@@ -247,7 +247,7 @@ IRExecutionUnit::GetRunnableInfo(Error &
 {
     lldb::ProcessSP process_sp(GetProcessWP().lock());
 
-    static Mutex s_runnable_info_mutex(Mutex::Type::eMutexTypeRecursive);
+    static std::recursive_mutex s_runnable_info_mutex;
 
     func_addr = LLDB_INVALID_ADDRESS;
     func_end = LLDB_INVALID_ADDRESS;
@@ -267,7 +267,7 @@ IRExecutionUnit::GetRunnableInfo(Error &
         return;
     };
 
-    Mutex::Locker runnable_info_mutex_locker(s_runnable_info_mutex);
+    std::lock_guard<std::recursive_mutex> guard(s_runnable_info_mutex);
 
     m_did_jit = true;
 

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Tue May 17 20:59:10 2016
@@ -19,7 +19,6 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Utility/LLDBAssert.h"
 
 using namespace lldb_private;
@@ -227,9 +226,9 @@ namespace lldb_private
             GetHistory (const std::string &prefix)
             {
                 typedef std::map<std::string, EditlineHistoryWP> WeakHistoryMap;
-                static Mutex g_mutex (Mutex::eMutexTypeRecursive);
+                static std::recursive_mutex g_mutex;
                 static WeakHistoryMap g_weak_map;
-                Mutex::Locker locker (g_mutex);
+                std::lock_guard<std::recursive_mutex> guard(g_mutex);
                 WeakHistoryMap::const_iterator pos = g_weak_map.find (prefix);
                 EditlineHistorySP history_sp;
                 if (pos != g_weak_map.end())
@@ -587,9 +586,9 @@ Editline::GetCharacter (EditLineCharType
         // (blocking operation), so we do not hold the mutex indefinitely. This gives a chance
         // for someone to interrupt us. After Read returns, immediately lock the mutex again and
         // check if we were interrupted.
-        m_output_mutex.Unlock();
+        m_output_mutex.unlock();
         int read_count = m_input_connection.Read(&ch, 1, UINT32_MAX, status, NULL);
-        m_output_mutex.Lock();
+        m_output_mutex.lock();
         if (m_editor_status == EditorStatus::Interrupted)
         {
             while (read_count > 0 && status == lldb::eConnectionStatusSuccess)
@@ -1284,7 +1283,7 @@ bool
 Editline::Interrupt()
 {
     bool result = true;
-    Mutex::Locker locker(m_output_mutex);
+    std::lock_guard<std::mutex> guard(m_output_mutex);
     if (m_editor_status == EditorStatus::Editing) {
         fprintf(m_output_file, "^C\n");
         result = m_input_connection.InterruptRead();
@@ -1297,7 +1296,7 @@ bool
 Editline::Cancel()
 {
     bool result = true;
-    Mutex::Locker locker(m_output_mutex);
+    std::lock_guard<std::mutex> guard(m_output_mutex);
     if (m_editor_status == EditorStatus::Editing) {
         MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart);
         fprintf(m_output_file, ANSI_CLEAR_BELOW);
@@ -1338,8 +1337,8 @@ Editline::GetLine (std::string &line, bo
     ConfigureEditor (false);
     m_input_lines = std::vector<EditLineStringType>();
     m_input_lines.insert (m_input_lines.begin(), EditLineConstString(""));
-    
-    Mutex::Locker locker(m_output_mutex);
+
+    std::lock_guard<std::mutex> guard(m_output_mutex);
 
     lldbassert(m_editor_status != EditorStatus::Editing);
     if (m_editor_status == EditorStatus::Interrupted)
@@ -1392,8 +1391,8 @@ Editline::GetLines (int first_line_numbe
     SetBaseLineNumber (first_line_number);
     m_input_lines = std::vector<EditLineStringType>();
     m_input_lines.insert (m_input_lines.begin(), EditLineConstString(""));
-    
-    Mutex::Locker locker(m_output_mutex);
+
+    std::lock_guard<std::mutex> guard(m_output_mutex);
     // Begin the line editing loop
     DisplayInput();
     SetCurrentLine (0);
@@ -1427,7 +1426,7 @@ Editline::GetLines (int first_line_numbe
 void
 Editline::PrintAsync (Stream *stream, const char *s, size_t len)
 {
-    Mutex::Locker locker(m_output_mutex);
+    std::lock_guard<std::mutex> guard(m_output_mutex);
     if (m_editor_status == EditorStatus::Editing)
     {
         MoveCursor(CursorLocation::EditingCursor, CursorLocation::BlockStart);

Modified: lldb/trunk/source/Host/common/NativeBreakpointList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeBreakpointList.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeBreakpointList.cpp (original)
+++ lldb/trunk/source/Host/common/NativeBreakpointList.cpp Tue May 17 20:59:10 2016
@@ -17,8 +17,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-NativeBreakpointList::NativeBreakpointList () :
-    m_mutex (Mutex::eMutexTypeRecursive)
+NativeBreakpointList::NativeBreakpointList() : m_mutex()
 {
 }
 
@@ -29,7 +28,7 @@ NativeBreakpointList::AddRef (lldb::addr
     if (log)
         log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64 ", size_hint = %lu, hardware = %s", __FUNCTION__, addr, size_hint, hardware ? "true" : "false");
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // Check if the breakpoint is already set.
     auto iter = m_breakpoints.find (addr);
@@ -72,7 +71,7 @@ NativeBreakpointList::DecRef (lldb::addr
     if (log)
         log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // Check if the breakpoint is already set.
     auto iter = m_breakpoints.find (addr);
@@ -136,7 +135,7 @@ NativeBreakpointList::EnableBreakpoint (
     if (log)
         log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // Ensure we have said breakpoint.
     auto iter = m_breakpoints.find (addr);
@@ -159,7 +158,7 @@ NativeBreakpointList::DisableBreakpoint
     if (log)
         log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // Ensure we have said breakpoint.
     auto iter = m_breakpoints.find (addr);
@@ -182,7 +181,7 @@ NativeBreakpointList::GetBreakpoint (lld
     if (log)
         log->Printf ("NativeBreakpointList::%s addr = 0x%" PRIx64, __FUNCTION__, addr);
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // Ensure we have said breakpoint.
     auto iter = m_breakpoints.find (addr);

Modified: lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeProcessProtocol.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeProcessProtocol.cpp (original)
+++ lldb/trunk/source/Host/common/NativeProcessProtocol.cpp Tue May 17 20:59:10 2016
@@ -26,22 +26,22 @@ using namespace lldb_private;
 // NativeProcessProtocol Members
 // -----------------------------------------------------------------------------
 
-NativeProcessProtocol::NativeProcessProtocol (lldb::pid_t pid) :
-    m_pid (pid),
-    m_threads (),
-    m_current_thread_id (LLDB_INVALID_THREAD_ID),
-    m_threads_mutex (Mutex::eMutexTypeRecursive),
-    m_state (lldb::eStateInvalid),
-    m_state_mutex (Mutex::eMutexTypeRecursive),
-    m_exit_type (eExitTypeInvalid),
-    m_exit_status (0),
-    m_exit_description (),
-    m_delegates_mutex (Mutex::eMutexTypeRecursive),
-    m_delegates (),
-    m_breakpoint_list (),
-    m_watchpoint_list (),
-    m_terminal_fd (-1),
-    m_stop_id (0)
+NativeProcessProtocol::NativeProcessProtocol(lldb::pid_t pid)
+    : m_pid(pid),
+      m_threads(),
+      m_current_thread_id(LLDB_INVALID_THREAD_ID),
+      m_threads_mutex(),
+      m_state(lldb::eStateInvalid),
+      m_state_mutex(),
+      m_exit_type(eExitTypeInvalid),
+      m_exit_status(0),
+      m_exit_description(),
+      m_delegates_mutex(),
+      m_delegates(),
+      m_breakpoint_list(),
+      m_watchpoint_list(),
+      m_terminal_fd(-1),
+      m_stop_id(0)
 {
 }
 
@@ -117,7 +117,7 @@ NativeProcessProtocol::SetExitStatus (Ex
 NativeThreadProtocolSP
 NativeProcessProtocol::GetThreadAtIndex (uint32_t idx)
 {
-    Mutex::Locker locker (m_threads_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
     if (idx < m_threads.size ())
         return m_threads[idx];
     return NativeThreadProtocolSP ();
@@ -137,7 +137,7 @@ NativeProcessProtocol::GetThreadByIDUnlo
 NativeThreadProtocolSP
 NativeProcessProtocol::GetThreadByID (lldb::tid_t tid)
 {
-    Mutex::Locker locker (m_threads_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
     return GetThreadByIDUnlocked (tid);
 }
 
@@ -221,7 +221,7 @@ NativeProcessProtocol::SetWatchpoint (ll
     // conceivable that if there are more threads than hardware
     // watchpoints available, some of the threads will fail to set
     // hardware watchpoints while software ones may be available.
-    Mutex::Locker locker (m_threads_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
     for (auto thread_sp : m_threads)
     {
         assert (thread_sp && "thread list should not have a NULL thread!");
@@ -276,7 +276,7 @@ NativeProcessProtocol::RemoveWatchpoint
 
     Error overall_error;
 
-    Mutex::Locker locker (m_threads_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_threads_mutex);
     for (auto thread_sp : m_threads)
     {
         assert (thread_sp && "thread list should not have a NULL thread!");
@@ -300,7 +300,7 @@ NativeProcessProtocol::RemoveWatchpoint
 bool
 NativeProcessProtocol::RegisterNativeDelegate (NativeDelegate &native_delegate)
 {
-    Mutex::Locker locker (m_delegates_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
     if (std::find (m_delegates.begin (), m_delegates.end (), &native_delegate) != m_delegates.end ())
         return false;
 
@@ -312,7 +312,7 @@ NativeProcessProtocol::RegisterNativeDel
 bool
 NativeProcessProtocol::UnregisterNativeDelegate (NativeDelegate &native_delegate)
 {
-    Mutex::Locker locker (m_delegates_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
 
     const auto initial_size = m_delegates.size ();
     m_delegates.erase (remove (m_delegates.begin (), m_delegates.end (), &native_delegate), m_delegates.end ());
@@ -327,7 +327,7 @@ NativeProcessProtocol::SynchronouslyNoti
 {
     Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
-    Mutex::Locker locker (m_delegates_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
     for (auto native_delegate: m_delegates)
         native_delegate->ProcessStateChanged (this, state);
 
@@ -354,7 +354,7 @@ NativeProcessProtocol::NotifyDidExec ()
         log->Printf ("NativeProcessProtocol::%s - preparing to call delegates", __FUNCTION__);
 
     {
-        Mutex::Locker locker (m_delegates_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex);
         for (auto native_delegate: m_delegates)
             native_delegate->DidExec (this);
     }
@@ -394,14 +394,14 @@ NativeProcessProtocol::DisableBreakpoint
 lldb::StateType
 NativeProcessProtocol::GetState () const
 {
-    Mutex::Locker locker (m_state_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
     return m_state;
 }
 
 void
 NativeProcessProtocol::SetState (lldb::StateType state, bool notify_delegates)
 {
-    Mutex::Locker locker (m_state_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
 
     if (state == m_state)
         return;
@@ -426,8 +426,8 @@ NativeProcessProtocol::SetState (lldb::S
 
 uint32_t NativeProcessProtocol::GetStopID () const
 {
-   Mutex::Locker locker (m_state_mutex);
-   return m_stop_id;
+    std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
+    return m_stop_id;
 }
 
 void

Modified: lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp (original)
+++ lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp Tue May 17 20:59:10 2016
@@ -12,7 +12,6 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Host/Debug.h"
-#include "lldb/Host/Mutex.h"
 
 #include "lldb/Host/common/NativeProcessProtocol.h"
 

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Tue May 17 20:59:10 2016
@@ -556,10 +556,10 @@ LaunchInNewTerminalWithAppleScript (cons
 // On MacOSX CrashReporter will display a string for each shared library if
 // the shared library has an exported symbol named "__crashreporter_info__".
 
-static Mutex&
-GetCrashReporterMutex ()
+static std::mutex &
+GetCrashReporterMutex()
 {
-    static Mutex g_mutex;
+    static std::mutex g_mutex;
     return g_mutex;
 }
 
@@ -573,8 +573,8 @@ void
 Host::SetCrashDescriptionWithFormat (const char *format, ...)
 {
     static StreamString g_crash_description;
-    Mutex::Locker locker (GetCrashReporterMutex ());
-    
+    std::lock_guard<std::mutex> guard(GetCrashReporterMutex());
+
     if (format)
     {
         va_list args;
@@ -593,7 +593,7 @@ Host::SetCrashDescriptionWithFormat (con
 void
 Host::SetCrashDescription (const char *cstr)
 {
-    Mutex::Locker locker (GetCrashReporterMutex ());
+    std::lock_guard<std::mutex> guard(GetCrashReporterMutex());
     static std::string g_crash_description;
     if (cstr)
     {

Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Tue May 17 20:59:10 2016
@@ -79,12 +79,12 @@ GetURLAddress(const char *url, const cha
 }
 
 ConnectionFileDescriptor::ConnectionFileDescriptor(bool child_processes_inherit)
-    : Connection()
-    , m_pipe()
-    , m_mutex(Mutex::eMutexTypeRecursive)
-    , m_shutting_down(false)
-    , m_waiting_for_accept(false)
-    , m_child_processes_inherit(child_processes_inherit)
+    : Connection(),
+      m_pipe(),
+      m_mutex(),
+      m_shutting_down(false),
+      m_waiting_for_accept(false),
+      m_child_processes_inherit(child_processes_inherit)
 {
     Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
     if (log)
@@ -92,30 +92,30 @@ ConnectionFileDescriptor::ConnectionFile
 }
 
 ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
-    : Connection()
-    , m_pipe()
-    , m_mutex(Mutex::eMutexTypeRecursive)
-    , m_shutting_down(false)
-    , m_waiting_for_accept(false)
-    , m_child_processes_inherit(false)
+    : Connection(),
+      m_pipe(),
+      m_mutex(),
+      m_shutting_down(false),
+      m_waiting_for_accept(false),
+      m_child_processes_inherit(false)
 {
     m_write_sp.reset(new File(fd, owns_fd));
     m_read_sp.reset(new File(fd, false));
 
     Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
     if (log)
-        log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)", static_cast<void *>(this), fd,
-                    owns_fd);
+        log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)",
+                    static_cast<void *>(this), fd, owns_fd);
     OpenCommandPipe();
 }
 
-ConnectionFileDescriptor::ConnectionFileDescriptor(Socket* socket)
-    : Connection()
-    , m_pipe()
-    , m_mutex(Mutex::eMutexTypeRecursive)
-    , m_shutting_down(false)
-    , m_waiting_for_accept(false)
-    , m_child_processes_inherit(false)
+ConnectionFileDescriptor::ConnectionFileDescriptor(Socket *socket)
+    : Connection(),
+      m_pipe(),
+      m_mutex(),
+      m_shutting_down(false),
+      m_waiting_for_accept(false),
+      m_child_processes_inherit(false)
 {
     InitializeSocket(socket);
 }
@@ -170,7 +170,7 @@ ConnectionFileDescriptor::IsConnected()
 ConnectionStatus
 ConnectionFileDescriptor::Connect(const char *s, Error *error_ptr)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
     if (log)
         log->Printf("%p ConnectionFileDescriptor::Connect (url = '%s')", static_cast<void *>(this), s);
@@ -374,10 +374,8 @@ ConnectionFileDescriptor::Disconnect(Err
 
     m_shutting_down = true;
 
-    Mutex::Locker locker;
-    bool got_lock = locker.TryLock(m_mutex);
-
-    if (!got_lock)
+    std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock);
+    if (!locker.try_lock())
     {
         if (m_pipe.CanWrite())
         {
@@ -392,7 +390,7 @@ ConnectionFileDescriptor::Disconnect(Err
             log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, but no command pipe is available.",
                         static_cast<void *>(this));
         }
-        locker.Lock(m_mutex);
+        locker.lock();
     }
 
     Error error = m_read_sp->Close();
@@ -415,9 +413,8 @@ ConnectionFileDescriptor::Read(void *dst
 {
     Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
 
-    Mutex::Locker locker;
-    bool got_lock = locker.TryLock(m_mutex);
-    if (!got_lock)
+    std::unique_lock<std::recursive_mutex> locker(m_mutex, std::defer_lock);
+    if (!locker.try_lock())
     {
         if (log)
             log->Printf("%p ConnectionFileDescriptor::Read () failed to get the connection lock.", static_cast<void *>(this));

Modified: lldb/trunk/source/Initialization/SystemLifetimeManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemLifetimeManager.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemLifetimeManager.cpp (original)
+++ lldb/trunk/source/Initialization/SystemLifetimeManager.cpp Tue May 17 20:59:10 2016
@@ -10,16 +10,13 @@
 #include "lldb/Initialization/SystemLifetimeManager.h"
 
 #include "lldb/Core/Debugger.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Initialization/SystemInitializer.h"
 
 #include <utility>
 
 using namespace lldb_private;
 
-SystemLifetimeManager::SystemLifetimeManager()
-    : m_mutex(Mutex::eMutexTypeRecursive)
-    , m_initialized(false)
+SystemLifetimeManager::SystemLifetimeManager() : m_mutex(), m_initialized(false)
 {
 }
 
@@ -32,7 +29,7 @@ void
 SystemLifetimeManager::Initialize(std::unique_ptr<SystemInitializer> initializer,
                                   LoadPluginCallbackType plugin_callback)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_initialized)
     {
         assert(!m_initializer &&
@@ -48,7 +45,7 @@ SystemLifetimeManager::Initialize(std::u
 void
 SystemLifetimeManager::Terminate()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (m_initialized)
     {

Modified: lldb/trunk/source/Interpreter/CommandHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandHistory.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandHistory.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandHistory.cpp Tue May 17 20:59:10 2016
@@ -15,10 +15,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-
-CommandHistory::CommandHistory () :
-    m_mutex(Mutex::eMutexTypeRecursive),
-    m_history()
+CommandHistory::CommandHistory() : m_mutex(), m_history()
 {}
 
 CommandHistory::~CommandHistory ()
@@ -27,21 +24,21 @@ CommandHistory::~CommandHistory ()
 size_t
 CommandHistory::GetSize () const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_history.size();
 }
 
 bool
 CommandHistory::IsEmpty () const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_history.empty();
 }
 
 const char*
 CommandHistory::FindString (const char* input_str) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!input_str)
         return nullptr;
     if (input_str[0] != g_repeat_char)
@@ -80,7 +77,7 @@ CommandHistory::FindString (const char*
 const char*
 CommandHistory::GetStringAtIndex (size_t idx) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (idx < m_history.size())
         return m_history[idx].c_str();
     return nullptr;
@@ -95,7 +92,7 @@ CommandHistory::operator [] (size_t idx)
 const char*
 CommandHistory::GetRecentmostString () const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_history.empty())
         return nullptr;
     return m_history.back().c_str();
@@ -105,7 +102,7 @@ void
 CommandHistory::AppendString (const std::string& str,
                               bool reject_if_dupe)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (reject_if_dupe)
     {
         if (!m_history.empty())
@@ -120,7 +117,7 @@ CommandHistory::AppendString (const std:
 void
 CommandHistory::Clear ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_history.clear();
 }
 
@@ -129,7 +126,7 @@ CommandHistory::Dump (Stream& stream,
                       size_t start_idx,
                       size_t stop_idx) const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     stop_idx = std::min(stop_idx + 1, m_history.size());
     for (size_t counter = start_idx;
          counter < stop_idx;

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h Tue May 17 20:59:10 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <memory>
+#include <mutex>
 #include <string>
 
 // Other libraries and framework includes
@@ -22,7 +23,6 @@
 #include "lldb/Core/Address.h"
 #include "lldb/Core/Disassembler.h"
 #include "lldb/Core/PluginManager.h"
-#include "lldb/Host/Mutex.h"
 
 // Opaque references to C++ Objects in LLVM's MC.
 namespace llvm
@@ -147,7 +147,7 @@ protected:
     void Lock(InstructionLLVMC *inst,
               const lldb_private::ExecutionContext *exe_ctx)
     {
-        m_mutex.Lock();
+        m_mutex.lock();
         m_inst = inst;
         m_exe_ctx = exe_ctx;
     }
@@ -156,12 +156,12 @@ protected:
     {
         m_inst = NULL;
         m_exe_ctx = NULL;
-        m_mutex.Unlock();
+        m_mutex.unlock();
     }
 
     const lldb_private::ExecutionContext *m_exe_ctx;
     InstructionLLVMC *m_inst;
-    lldb_private::Mutex m_mutex;
+    std::mutex m_mutex;
     bool m_data_from_file;
 
     std::unique_ptr<LLVMCDisassembler> m_disasm_ap;

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Tue May 17 20:59:10 2016
@@ -452,16 +452,16 @@ DynamicLoaderDarwinKernel::CheckForKerne
 //----------------------------------------------------------------------
 // Constructor
 //----------------------------------------------------------------------
-DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel (Process* process, lldb::addr_t kernel_addr) :
-    DynamicLoader(process),
-    m_kernel_load_address (kernel_addr),
-    m_kernel(),
-    m_kext_summary_header_ptr_addr (),
-    m_kext_summary_header_addr (),
-    m_kext_summary_header (),
-    m_known_kexts (),
-    m_mutex(Mutex::eMutexTypeRecursive),
-    m_break_id (LLDB_INVALID_BREAK_ID)
+DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(Process *process, lldb::addr_t kernel_addr)
+    : DynamicLoader(process),
+      m_kernel_load_address(kernel_addr),
+      m_kernel(),
+      m_kext_summary_header_ptr_addr(),
+      m_kext_summary_header_addr(),
+      m_kext_summary_header(),
+      m_known_kexts(),
+      m_mutex(),
+      m_break_id(LLDB_INVALID_BREAK_ID)
 {
     Error error;
     PlatformSP platform_sp(Platform::Create(PlatformDarwinKernel::GetPluginNameStatic(), error));
@@ -470,7 +470,7 @@ DynamicLoaderDarwinKernel::DynamicLoader
     // shouldn't be done if kext loading is explicitly disabled.
     if (platform_sp.get() && GetGlobalProperties()->GetLoadKexts())
     {
-        process->GetTarget().SetPlatform (platform_sp);
+        process->GetTarget().SetPlatform(platform_sp);
     }
 }
 
@@ -521,7 +521,7 @@ DynamicLoaderDarwinKernel::DidLaunch ()
 void
 DynamicLoaderDarwinKernel::Clear (bool clear_process)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (m_process->IsAlive() && LLDB_BREAK_ID_IS_VALID(m_break_id))
         m_process->ClearBreakpointSiteByID(m_break_id);
@@ -1131,7 +1131,7 @@ DynamicLoaderDarwinKernel::BreakpointHit
 bool
 DynamicLoaderDarwinKernel::ReadKextSummaryHeader ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // the all image infos is already valid for this process stop ID
 
@@ -1216,8 +1216,8 @@ DynamicLoaderDarwinKernel::ParseKextSumm
     Log *log(GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
     if (log)
         log->Printf ("Kexts-changed breakpoint hit, there are %d kexts currently.\n", count);
-        
-    Mutex::Locker locker(m_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (!ReadKextSummaries (kext_summary_addr, count, kext_summaries))
         return false;
@@ -1438,8 +1438,8 @@ DynamicLoaderDarwinKernel::ReadKextSumma
 bool
 DynamicLoaderDarwinKernel::ReadAllKextSummaries ()
 {
-    Mutex::Locker locker(m_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
+
     if (ReadKextSummaryHeader ())
     {
         if (m_kext_summary_header.entry_count > 0 && m_kext_summary_header_addr.IsValid())
@@ -1508,7 +1508,7 @@ DynamicLoaderDarwinKernel::PutToLog(Log
     if (log == NULL)
         return;
 
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     log->Printf("gLoadedKextSummaries = 0x%16.16" PRIx64 " { version=%u, entry_size=%u, entry_count=%u }",
                 m_kext_summary_header_addr.GetFileAddress(),
                 m_kext_summary_header.version,

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h Tue May 17 20:59:10 2016
@@ -12,8 +12,9 @@
 
 // C Includes
 // C++ Includes
-#include <vector>
+#include <mutex>
 #include <string>
+#include <vector>
 
 // Other libraries and framework includes
 // Project includes
@@ -21,7 +22,6 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/TimeValue.h"
 #include "lldb/Core/UUID.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 
 class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader
@@ -361,7 +361,7 @@ protected:
     lldb_private::Address          m_kext_summary_header_addr;
     OSKextLoadedKextSummaryHeader  m_kext_summary_header;
     KextImageInfo::collection      m_known_kexts;
-    mutable lldb_private::Mutex    m_mutex;
+    mutable std::recursive_mutex m_mutex;
     lldb::user_id_t                m_break_id;
 
 private:

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue May 17 20:59:10 2016
@@ -138,18 +138,18 @@ DynamicLoaderMacOSXDYLD::CreateInstance
 //----------------------------------------------------------------------
 // Constructor
 //----------------------------------------------------------------------
-DynamicLoaderMacOSXDYLD::DynamicLoaderMacOSXDYLD (Process* process) :
-    DynamicLoader(process),
-    m_dyld(),
-    m_dyld_module_wp(),
-    m_dyld_all_image_infos_addr(LLDB_INVALID_ADDRESS),
-    m_dyld_all_image_infos(),
-    m_dyld_all_image_infos_stop_id (UINT32_MAX),
-    m_break_id(LLDB_INVALID_BREAK_ID),
-    m_dyld_image_infos(),
-    m_dyld_image_infos_stop_id (UINT32_MAX),
-    m_mutex(Mutex::eMutexTypeRecursive),
-    m_process_image_addr_is_all_images_infos (false)
+DynamicLoaderMacOSXDYLD::DynamicLoaderMacOSXDYLD(Process *process)
+    : DynamicLoader(process),
+      m_dyld(),
+      m_dyld_module_wp(),
+      m_dyld_all_image_infos_addr(LLDB_INVALID_ADDRESS),
+      m_dyld_all_image_infos(),
+      m_dyld_all_image_infos_stop_id(UINT32_MAX),
+      m_break_id(LLDB_INVALID_BREAK_ID),
+      m_dyld_image_infos(),
+      m_dyld_image_infos_stop_id(UINT32_MAX),
+      m_mutex(),
+      m_process_image_addr_is_all_images_infos(false)
 {
 }
 
@@ -244,7 +244,7 @@ DynamicLoaderMacOSXDYLD::ProcessDidExec
 void
 DynamicLoaderMacOSXDYLD::Clear (bool clear_process)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (LLDB_BREAK_ID_IS_VALID(m_break_id))
         m_process->GetTarget().RemoveBreakpointByID (m_break_id);
@@ -683,7 +683,7 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpoin
 bool
 DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     // the all image infos is already valid for this process stop ID
     if (m_process->GetStopID() == m_dyld_all_image_infos_stop_id)
@@ -974,8 +974,8 @@ DynamicLoaderMacOSXDYLD::AddModulesUsing
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
     if (log)
         log->Printf ("Adding %d modules.\n", image_infos_count);
-        
-    Mutex::Locker locker(m_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_process->GetStopID() == m_dyld_image_infos_stop_id)
         return true;
 
@@ -1097,8 +1097,8 @@ DynamicLoaderMacOSXDYLD::RemoveModulesUs
 {
     DYLDImageInfo::collection image_infos;
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
-    
-    Mutex::Locker locker(m_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_process->GetStopID() == m_dyld_image_infos_stop_id)
         return true;
 
@@ -1239,8 +1239,8 @@ bool
 DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ()
 {
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
-    
-    Mutex::Locker locker(m_mutex);
+
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_process->GetStopID() == m_dyld_image_infos_stop_id
           || m_dyld_image_infos.size() != 0)
         return false;
@@ -1678,7 +1678,7 @@ DynamicLoaderMacOSXDYLD::PutToLog(Log *l
     if (log == NULL)
         return;
 
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     log->Printf("dyld_all_image_infos = { version=%d, count=%d, addr=0x%8.8" PRIx64 ", notify=0x%8.8" PRIx64 " }",
                     m_dyld_all_image_infos.version,
                     m_dyld_all_image_infos.dylib_info_count,

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h Tue May 17 20:59:10 2016
@@ -12,6 +12,7 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
@@ -20,7 +21,6 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Core/StructuredData.h"
 #include "lldb/Core/UUID.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/SafeMachO.h"
 
@@ -374,7 +374,7 @@ protected:
     lldb::user_id_t m_break_id;
     DYLDImageInfo::collection m_dyld_image_infos;   // Current shared libraries information
     uint32_t m_dyld_image_infos_stop_id;    // The process stop ID that "m_dyld_image_infos" is valid for
-    mutable lldb_private::Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
     lldb_private::Process::Notifications m_notification_callbacks;
     bool m_process_image_addr_is_all_images_infos;
 

Modified: lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h Tue May 17 20:59:10 2016
@@ -17,7 +17,6 @@
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Core/UUID.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 
 class DynamicLoaderStatic : public lldb_private::DynamicLoader

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Tue May 17 20:59:10 2016
@@ -499,11 +499,9 @@ ClassDescriptorV2::GetInstanceSize ()
     return 0;
 }
 
-ClassDescriptorV2::iVarsStorage::iVarsStorage ():
-m_filled(false),
-m_ivars(),
-m_mutex(Mutex::eMutexTypeRecursive)
-{}
+ClassDescriptorV2::iVarsStorage::iVarsStorage() : m_filled(false), m_ivars(), m_mutex()
+{
+}
 
 size_t
 ClassDescriptorV2::iVarsStorage::size ()
@@ -522,7 +520,7 @@ ClassDescriptorV2::iVarsStorage::fill (A
 {
     if (m_filled)
         return;
-    Mutex::Locker lock(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
     if (log)
         log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s", descriptor.GetClassName().AsCString("<unknown"));

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h Tue May 17 20:59:10 2016
@@ -12,10 +12,11 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "AppleObjCRuntimeV2.h"
 
@@ -247,7 +248,7 @@ private:
     private:
         bool m_filled;
         std::vector<iVarDescriptor> m_ivars;
-        Mutex m_mutex;
+        std::recursive_mutex m_mutex;
     };
     
     // The constructor should only be invoked by the runtime as it builds its caches

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue May 17 20:59:10 2016
@@ -379,27 +379,27 @@ ExtractRuntimeGlobalSymbol (Process* pro
     }
 }
 
-AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process,
-                                        const ModuleSP &objc_module_sp) :
-    AppleObjCRuntime (process),
-    m_get_class_info_code(),
-    m_get_class_info_args (LLDB_INVALID_ADDRESS),
-    m_get_class_info_args_mutex (Mutex::eMutexTypeNormal),
-    m_get_shared_cache_class_info_code(),
-    m_get_shared_cache_class_info_args (LLDB_INVALID_ADDRESS),
-    m_get_shared_cache_class_info_args_mutex (Mutex::eMutexTypeNormal),
-    m_decl_vendor_ap (),
-    m_isa_hash_table_ptr (LLDB_INVALID_ADDRESS),
-    m_hash_signature (),
-    m_has_object_getClass (false),
-    m_loaded_objc_opt (false),
-    m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this,objc_module_sp)),
-    m_tagged_pointer_vendor_ap(TaggedPointerVendorV2::CreateInstance(*this,objc_module_sp)),
-    m_encoding_to_type_sp(),
-    m_noclasses_warning_emitted(false)
+AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process, const ModuleSP &objc_module_sp)
+    : AppleObjCRuntime(process),
+      m_get_class_info_code(),
+      m_get_class_info_args(LLDB_INVALID_ADDRESS),
+      m_get_class_info_args_mutex(),
+      m_get_shared_cache_class_info_code(),
+      m_get_shared_cache_class_info_args(LLDB_INVALID_ADDRESS),
+      m_get_shared_cache_class_info_args_mutex(),
+      m_decl_vendor_ap(),
+      m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS),
+      m_hash_signature(),
+      m_has_object_getClass(false),
+      m_loaded_objc_opt(false),
+      m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this, objc_module_sp)),
+      m_tagged_pointer_vendor_ap(TaggedPointerVendorV2::CreateInstance(*this, objc_module_sp)),
+      m_encoding_to_type_sp(),
+      m_noclasses_warning_emitted(false)
 {
     static const ConstString g_gdb_object_getClass("gdb_object_getClass");
-    m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
+    m_has_object_getClass =
+        (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
 }
 
 bool
@@ -1483,8 +1483,8 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
     
     if (class_infos_addr == LLDB_INVALID_ADDRESS)
         return false;
-    
-    Mutex::Locker locker(m_get_class_info_args_mutex);
+
+    std::lock_guard<std::mutex> guard(m_get_class_info_args_mutex);
 
     // Fill in our function argument values
     arguments.GetValueAtIndex(0)->GetScalar() = hash_table.GetTableLoadAddress();
@@ -1735,9 +1735,9 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
     
     if (class_infos_addr == LLDB_INVALID_ADDRESS)
         return DescriptorMapUpdateResult::Fail();
-    
-    Mutex::Locker locker(m_get_shared_cache_class_info_args_mutex);
-    
+
+    std::lock_guard<std::mutex> guard(m_get_shared_cache_class_info_args_mutex);
+
     // Fill in our function argument values
     arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
     arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Tue May 17 20:59:10 2016
@@ -14,6 +14,7 @@
 // C++ Includes
 #include <map>
 #include <memory>
+#include <mutex>
 
 // Other libraries and framework includes
 // Project includes
@@ -353,11 +354,11 @@ private:
 
     std::unique_ptr<UtilityFunction>        m_get_class_info_code;
     lldb::addr_t                            m_get_class_info_args;
-    Mutex                                   m_get_class_info_args_mutex;
+    std::mutex m_get_class_info_args_mutex;
 
     std::unique_ptr<UtilityFunction>        m_get_shared_cache_class_info_code;
     lldb::addr_t                            m_get_shared_cache_class_info_args;
-    Mutex                                   m_get_shared_cache_class_info_args_mutex;
+    std::mutex m_get_shared_cache_class_info_args_mutex;
 
     std::unique_ptr<DeclVendor>             m_decl_vendor_ap;
     lldb::addr_t                            m_isa_hash_table_ptr;

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Tue May 17 20:59:10 2016
@@ -751,8 +751,8 @@ AppleObjCTrampolineHandler::SetupDispatc
 
     // Scope for mutex locker:
     {
-        Mutex::Locker locker(m_impl_function_mutex);
-        
+        std::lock_guard<std::mutex> guard(m_impl_function_mutex);
+
         // First stage is to make the ClangUtility to hold our injected function:
 
         if (!m_impl_code.get())

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Tue May 17 20:59:10 2016
@@ -13,12 +13,12 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Expression/UtilityFunction.h"
 
 namespace lldb_private
@@ -196,7 +196,7 @@ private:
     lldb::ProcessWP m_process_wp;
     lldb::ModuleSP m_objc_module_sp;
     std::unique_ptr<UtilityFunction> m_impl_code;
-    Mutex m_impl_function_mutex;
+    std::mutex m_impl_function_mutex;
     lldb::addr_t m_impl_fn_addr;
     lldb::addr_t m_impl_stret_fn_addr;
     lldb::addr_t m_msg_forward_addr;

Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Tue May 17 20:59:10 2016
@@ -35,7 +35,6 @@ typedef struct ar_hdr
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/Timer.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
 
 using namespace lldb;
@@ -226,7 +225,7 @@ ObjectContainerBSDArchive::Archive::Find
 ObjectContainerBSDArchive::Archive::shared_ptr
 ObjectContainerBSDArchive::Archive::FindCachedArchive (const FileSpec &file, const ArchSpec &arch, const TimeValue &time, lldb::offset_t file_offset)
 {
-    Mutex::Locker locker(Archive::GetArchiveCacheMutex ());
+    std::lock_guard<std::recursive_mutex> guard(Archive::GetArchiveCacheMutex());
     shared_ptr archive_sp;
     Archive::Map &archive_map = Archive::GetArchiveCache ();
     Archive::Map::iterator pos = archive_map.find (file);
@@ -281,7 +280,7 @@ ObjectContainerBSDArchive::Archive::Pars
         const size_t num_objects = archive_sp->ParseObjects ();
         if (num_objects > 0)
         {
-            Mutex::Locker locker(Archive::GetArchiveCacheMutex ());
+            std::lock_guard<std::recursive_mutex> guard(Archive::GetArchiveCacheMutex());
             Archive::GetArchiveCache().insert(std::make_pair(file, archive_sp));
         }
         else
@@ -299,14 +298,13 @@ ObjectContainerBSDArchive::Archive::GetA
     return g_archive_map;
 }
 
-Mutex &
-ObjectContainerBSDArchive::Archive::GetArchiveCacheMutex ()
+std::recursive_mutex &
+ObjectContainerBSDArchive::Archive::GetArchiveCacheMutex()
 {
-    static Mutex g_archive_map_mutex (Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_archive_map_mutex;
     return g_archive_map_mutex;
 }
 
-
 void
 ObjectContainerBSDArchive::Initialize()
 {

Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Tue May 17 20:59:10 2016
@@ -12,6 +12,8 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Symbol/ObjectContainer.h"
@@ -138,8 +140,8 @@ protected:
         static Map &
         GetArchiveCache ();
 
-        static lldb_private::Mutex &
-        GetArchiveCacheMutex ();
+        static std::recursive_mutex &
+        GetArchiveCacheMutex();
 
         static Archive::shared_ptr
         FindCachedArchive (const lldb_private::FileSpec &file,

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Tue May 17 20:59:10 2016
@@ -2938,7 +2938,7 @@ ObjectFileELF::GetSymtab()
             return NULL;
 
         uint64_t symbol_id = 0;
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
 
         // Sharable objects and dynamic executables usually have 2 distinct symbol
         // tables, one named ".symtab", and the other ".dynsym". The dynsym is a smaller
@@ -3102,7 +3102,7 @@ ObjectFileELF::Dump(Stream *s)
         return;
     }
 
-    lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
     s->Printf("%p: ", static_cast<void *>(this));
     s->Indent();
     s->PutCString("ObjectFileELF");

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp Tue May 17 20:59:10 2016
@@ -158,7 +158,7 @@ ObjectFileJIT::GetSymtab()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_symtab_ap.get() == NULL)
         {
             m_symtab_ap.reset(new Symtab(this));
@@ -200,7 +200,7 @@ ObjectFileJIT::Dump (Stream *s)
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         s->Printf("%p: ", static_cast<void*>(this));
         s->Indent();
         s->PutCString("ObjectFileJIT");

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue May 17 20:59:10 2016
@@ -1217,7 +1217,7 @@ ObjectFileMachO::ParseHeader ()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         bool can_parse = false;
         lldb::offset_t offset = 0;
         m_data.SetByteOrder (endian::InlHostByteOrder());
@@ -1457,7 +1457,7 @@ ObjectFileMachO::GetSymtab()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_symtab_ap.get() == NULL)
         {
             m_symtab_ap.reset(new Symtab(this));
@@ -4755,7 +4755,7 @@ ObjectFileMachO::Dump (Stream *s)
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         s->Printf("%p: ", static_cast<void*>(this));
         s->Indent();
         if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64)
@@ -4911,7 +4911,7 @@ ObjectFileMachO::GetUUID (lldb_private::
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
         return GetUUID (m_header, m_data, offset, *uuid);
     }
@@ -4925,7 +4925,7 @@ ObjectFileMachO::GetDependentModules (Fi
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         struct load_command load_cmd;
         lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
         std::vector<std::string> rpath_paths;
@@ -5053,7 +5053,7 @@ ObjectFileMachO::GetEntryPointAddress ()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         struct load_command load_cmd;
         lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
         uint32_t i;
@@ -5203,7 +5203,7 @@ ObjectFileMachO::GetNumThreadContexts ()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (!m_thread_context_offsets_valid)
         {
             m_thread_context_offsets_valid = true;
@@ -5237,7 +5237,7 @@ ObjectFileMachO::GetThreadContextAtIndex
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (!m_thread_context_offsets_valid)
             GetNumThreadContexts ();
 
@@ -5373,7 +5373,7 @@ ObjectFileMachO::GetVersion (uint32_t *v
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         struct dylib_command load_cmd;
         lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
         uint32_t version_cmd = 0;
@@ -5428,7 +5428,7 @@ ObjectFileMachO::GetArchitecture (ArchSp
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         return GetArchitecture (m_header, m_data, MachHeaderSizeFromMagic(m_header.magic), arch);
     }
     return false;

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Tue May 17 20:59:10 2016
@@ -19,7 +19,6 @@
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/ObjectFile.h"
 
 //----------------------------------------------------------------------

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Tue May 17 20:59:10 2016
@@ -212,7 +212,7 @@ ObjectFilePECOFF::ParseHeader ()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         m_sect_headers.clear();
         m_data.SetByteOrder (eByteOrderLittle);
         lldb::offset_t offset = 0;
@@ -534,7 +534,7 @@ ObjectFilePECOFF::GetSymtab()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_symtab_ap.get() == NULL)
         {
             SectionList *sect_list = GetSectionList();
@@ -689,7 +689,7 @@ ObjectFilePECOFF::CreateSections (Sectio
         ModuleSP module_sp(GetModule());
         if (module_sp)
         {
-            lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+            std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
             const uint32_t nsects = m_sect_headers.size();
             ModuleSP module_sp (GetModule());
             for (uint32_t idx = 0; idx<nsects; ++idx)
@@ -847,7 +847,7 @@ ObjectFilePECOFF::Dump(Stream *s)
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         s->Printf("%p: ", static_cast<void*>(this));
         s->Indent();
         s->PutCString("ObjectFilePECOFF");

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Tue May 17 20:59:10 2016
@@ -252,7 +252,7 @@ FileSpec
 PlatformAppleSimulator::GetCoreSimulatorPath()
 {
 #if defined(__APPLE__)
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (!m_core_simulator_framework_path.hasValue())
     {
         const char *developer_dir = GetDeveloperDirectory();

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp Tue May 17 20:59:10 2016
@@ -304,7 +304,7 @@ EnumerateDirectoryCallback (void *baton,
 const char *
 PlatformAppleTVSimulator::GetSDKDirectoryAsCString()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (m_sdk_directory.empty())
     {
         const char *developer_dir = GetDeveloperDirectory();

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Tue May 17 20:59:10 2016
@@ -304,7 +304,7 @@ EnumerateDirectoryCallback (void *baton,
 const char *
 PlatformAppleWatchSimulator::GetSDKDirectoryAsCString()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (m_sdk_directory.empty())
     {
         const char *developer_dir = GetDeveloperDirectory();

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Tue May 17 20:59:10 2016
@@ -1015,7 +1015,7 @@ PlatformDarwin::ARMGetSupportedArchitect
 const char *
 PlatformDarwin::GetDeveloperDirectory()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (m_developer_directory.empty())
     {
         bool developer_dir_path_valid = false;
@@ -1572,10 +1572,10 @@ PlatformDarwin::AddClangModuleCompilatio
     FileSpec sysroot_spec;
     // Scope for mutex locker below
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::mutex> guard(m_mutex);
         sysroot_spec = GetSDKDirectoryForModules(sdk_type);
     }
-    
+
     if (sysroot_spec.IsDirectory())
     {
         options.push_back("-isysroot");

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Tue May 17 20:59:10 2016
@@ -308,7 +308,7 @@ EnumerateDirectoryCallback (void *baton,
 const char *
 PlatformiOSSimulator::GetSDKDirectoryAsCString()
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
     if (m_sdk_directory.empty())
     {
         const char *developer_dir = GetDeveloperDirectory();

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Tue May 17 20:59:10 2016
@@ -229,7 +229,7 @@ ProcessFreeBSD::WillResume()
 void
 ProcessFreeBSD::SendMessage(const ProcessMessage &message)
 {
-    Mutex::Locker lock(m_message_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_message_mutex);
 
     switch (message.GetKind())
     {
@@ -274,7 +274,7 @@ ProcessFreeBSD::ProcessFreeBSD(lldb::Tar
       m_byte_order(endian::InlHostByteOrder()),
       m_monitor(NULL),
       m_module(NULL),
-      m_message_mutex (Mutex::eMutexTypeRecursive),
+      m_message_mutex(),
       m_exit_now(false),
       m_seen_initial_stop(),
       m_resume_signo(0)
@@ -603,7 +603,7 @@ ProcessFreeBSD::RefreshStateAfterStop()
     if (log && log->GetMask().Test(POSIX_LOG_VERBOSE))
         log->Printf ("ProcessFreeBSD::%s(), message_queue size = %d", __FUNCTION__, (int)m_message_queue.size());
 
-    Mutex::Locker lock(m_message_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_message_mutex);
 
     // This method used to only handle one message.  Changing it to loop allows
     // it to handle the case where we hit a breakpoint while handling a different

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h Tue May 17 20:59:10 2016
@@ -13,8 +13,9 @@
 // C Includes
 
 // C++ Includes
-#include <set>
+#include <mutex>
 #include <queue>
+#include <set>
 
 // Other libraries and framework includes
 #include "lldb/Target/Process.h"
@@ -212,7 +213,7 @@ protected:
     lldb_private::Module *m_module;
 
     /// Message queue notifying this instance of inferior process state changes.
-    lldb_private::Mutex m_message_mutex;
+    std::recursive_mutex m_message_mutex;
     std::queue<ProcessMessage> m_message_queue;
 
     /// Drive any exit events to completion.

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Tue May 17 20:59:10 2016
@@ -1348,7 +1348,7 @@ ProcessMonitor::ServeOperation(Operation
 void
 ProcessMonitor::DoOperation(Operation *op)
 {
-    Mutex::Locker lock(m_operation_mutex);
+    std::lock_guard<std::mutex> guard(m_operation_mutex);
 
     m_operation = op;
 

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h Tue May 17 20:59:10 2016
@@ -15,11 +15,12 @@
 #include <signal.h>
 
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 #include "lldb/lldb-types.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/HostThread.h"
-#include "lldb/Host/Mutex.h"
 
 namespace lldb_private
 {
@@ -223,7 +224,7 @@ private:
 
     // current operation which must be executed on the privileged thread
     Operation *m_operation;
-    lldb_private::Mutex m_operation_mutex;
+    std::mutex m_operation_mutex;
 
     // semaphores notified when Operation is ready to be processed and when
     // the operation is complete.

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Tue May 17 20:59:10 2016
@@ -284,8 +284,8 @@ bool
 CommunicationKDP::CheckForPacket (const uint8_t *src, size_t src_len, DataExtractor &packet)
 {
     // Put the packet data into the buffer in a thread safe fashion
-    Mutex::Locker locker(m_bytes_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
+
     Log *log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PACKETS));
 
     if (src && src_len > 0)

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryThread.cpp Tue May 17 20:59:10 2016
@@ -22,28 +22,24 @@ using namespace lldb_private;
 
 //  Constructor
 
-HistoryThread::HistoryThread (lldb_private::Process &process, 
-                              lldb::tid_t tid,
-                              std::vector<lldb::addr_t> pcs, 
-                              uint32_t stop_id, 
-                              bool stop_id_is_valid) : 
-        Thread (process, tid, true),
-        m_framelist_mutex(),
-        m_framelist(),
-        m_pcs (pcs),
-        m_stop_id (stop_id),
-        m_stop_id_is_valid (stop_id_is_valid),
-        m_extended_unwind_token (LLDB_INVALID_ADDRESS),
-        m_queue_name (),
-        m_thread_name (),
-        m_originating_unique_thread_id (tid),
-        m_queue_id (LLDB_INVALID_QUEUE_ID)
+HistoryThread::HistoryThread(lldb_private::Process &process, lldb::tid_t tid, std::vector<lldb::addr_t> pcs,
+                             uint32_t stop_id, bool stop_id_is_valid)
+    : Thread(process, tid, true),
+      m_framelist_mutex(),
+      m_framelist(),
+      m_pcs(pcs),
+      m_stop_id(stop_id),
+      m_stop_id_is_valid(stop_id_is_valid),
+      m_extended_unwind_token(LLDB_INVALID_ADDRESS),
+      m_queue_name(),
+      m_thread_name(),
+      m_originating_unique_thread_id(tid),
+      m_queue_id(LLDB_INVALID_QUEUE_ID)
 {
-    m_unwinder_ap.reset (new HistoryUnwind (*this, pcs, stop_id_is_valid));
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    m_unwinder_ap.reset(new HistoryUnwind(*this, pcs, stop_id_is_valid));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
     if (log)
-        log->Printf ("%p HistoryThread::HistoryThread",
-                     static_cast<void*>(this));
+        log->Printf("%p HistoryThread::HistoryThread", static_cast<void *>(this));
 }
 
 //  Destructor
@@ -78,7 +74,9 @@ HistoryThread::CreateRegisterContextForF
 lldb::StackFrameListSP
 HistoryThread::GetStackFrameList ()
 {
-    Mutex::Locker (m_framelist_mutex);   // FIXME do not throw away the lock after we acquire it..
+    // FIXME do not throw away the lock after we acquire it..
+    std::unique_lock<std::mutex> lock(m_framelist_mutex);
+    lock.release();
     if (m_framelist.get() == NULL)
     {
         m_framelist.reset (new StackFrameList (*this, StackFrameListSP(), true));

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryThread.h Tue May 17 20:59:10 2016
@@ -12,10 +12,11 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/UserID.h"
@@ -125,7 +126,7 @@ protected:
     virtual lldb::StackFrameListSP
     GetStackFrameList ();
 
-    mutable Mutex               m_framelist_mutex;
+    mutable std::mutex m_framelist_mutex;
     lldb::StackFrameListSP      m_framelist;
     std::vector<lldb::addr_t>   m_pcs;
     uint32_t                    m_stop_id;

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.cpp Tue May 17 20:59:10 2016
@@ -40,7 +40,7 @@ HistoryUnwind::~HistoryUnwind ()
 void
 HistoryUnwind::DoClear ()
 {
-    Mutex::Locker locker(m_unwind_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_unwind_mutex);
     m_pcs.clear();
     m_stop_id_is_valid = false;
 }
@@ -64,7 +64,9 @@ HistoryUnwind::DoCreateRegisterContextFo
 bool
 HistoryUnwind::DoGetFrameInfoAtIndex (uint32_t frame_idx, lldb::addr_t& cfa, lldb::addr_t& pc)
 {
-    Mutex::Locker (m_unwind_mutex);   // FIXME do not throw away the lock after we acquire it..
+    // FIXME do not throw away the lock after we acquire it..
+    std::unique_lock<std::recursive_mutex> guard(m_unwind_mutex);
+    guard.release();
     if (frame_idx < m_pcs.size())
     {
         cfa = frame_idx;

Modified: lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/HistoryUnwind.h Tue May 17 20:59:10 2016
@@ -17,7 +17,6 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Unwind.h"
 
 namespace lldb_private {

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue May 17 20:59:10 2016
@@ -793,8 +793,8 @@ GDBRemoteCommunication::PacketType
 GDBRemoteCommunication::CheckForPacket (const uint8_t *src, size_t src_len, StringExtractorGDBRemote &packet)
 {
     // Put the packet data into the buffer in a thread safe fashion
-    Mutex::Locker locker(m_bytes_mutex);
-    
+    std::lock_guard<std::recursive_mutex> guard(m_bytes_mutex);
+
     Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PACKETS));
 
     if (src && src_len > 0)

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Tue May 17 20:59:10 2016
@@ -55,79 +55,79 @@ using namespace lldb_private::process_gd
 //----------------------------------------------------------------------
 // GDBRemoteCommunicationClient constructor
 //----------------------------------------------------------------------
-GDBRemoteCommunicationClient::GDBRemoteCommunicationClient() :
-    GDBRemoteCommunication("gdb-remote.client", "gdb-remote.client.rx_packet"),
-    m_supports_not_sending_acks (eLazyBoolCalculate),
-    m_supports_thread_suffix (eLazyBoolCalculate),
-    m_supports_threads_in_stop_reply (eLazyBoolCalculate),
-    m_supports_vCont_all (eLazyBoolCalculate),
-    m_supports_vCont_any (eLazyBoolCalculate),
-    m_supports_vCont_c (eLazyBoolCalculate),
-    m_supports_vCont_C (eLazyBoolCalculate),
-    m_supports_vCont_s (eLazyBoolCalculate),
-    m_supports_vCont_S (eLazyBoolCalculate),
-    m_qHostInfo_is_valid (eLazyBoolCalculate),
-    m_curr_pid_is_valid (eLazyBoolCalculate),
-    m_qProcessInfo_is_valid (eLazyBoolCalculate),
-    m_qGDBServerVersion_is_valid (eLazyBoolCalculate),
-    m_supports_alloc_dealloc_memory (eLazyBoolCalculate),
-    m_supports_memory_region_info  (eLazyBoolCalculate),
-    m_supports_watchpoint_support_info  (eLazyBoolCalculate),
-    m_supports_detach_stay_stopped (eLazyBoolCalculate),
-    m_watchpoints_trigger_after_instruction(eLazyBoolCalculate),
-    m_attach_or_wait_reply(eLazyBoolCalculate),
-    m_prepare_for_reg_writing_reply (eLazyBoolCalculate),
-    m_supports_p (eLazyBoolCalculate),
-    m_supports_x (eLazyBoolCalculate),
-    m_avoid_g_packets (eLazyBoolCalculate),
-    m_supports_QSaveRegisterState (eLazyBoolCalculate),
-    m_supports_qXfer_auxv_read (eLazyBoolCalculate),
-    m_supports_qXfer_libraries_read (eLazyBoolCalculate),
-    m_supports_qXfer_libraries_svr4_read (eLazyBoolCalculate),
-    m_supports_qXfer_features_read (eLazyBoolCalculate),
-    m_supports_augmented_libraries_svr4_read (eLazyBoolCalculate),
-    m_supports_jThreadExtendedInfo (eLazyBoolCalculate),
-    m_supports_jLoadedDynamicLibrariesInfos (eLazyBoolCalculate),
-    m_supports_qProcessInfoPID (true),
-    m_supports_qfProcessInfo (true),
-    m_supports_qUserName (true),
-    m_supports_qGroupName (true),
-    m_supports_qThreadStopInfo (true),
-    m_supports_z0 (true),
-    m_supports_z1 (true),
-    m_supports_z2 (true),
-    m_supports_z3 (true),
-    m_supports_z4 (true),
-    m_supports_QEnvironment (true),
-    m_supports_QEnvironmentHexEncoded (true),
-    m_supports_qSymbol (true),
-    m_qSymbol_requests_done (false),
-    m_supports_qModuleInfo (true),
-    m_supports_jThreadsInfo (true),
-    m_curr_pid (LLDB_INVALID_PROCESS_ID),
-    m_curr_tid (LLDB_INVALID_THREAD_ID),
-    m_curr_tid_run (LLDB_INVALID_THREAD_ID),
-    m_num_supported_hardware_watchpoints (0),
-    m_async_mutex (Mutex::eMutexTypeRecursive),
-    m_async_packet_predicate (false),
-    m_async_packet (),
-    m_async_result (PacketResult::Success),
-    m_async_response (),
-    m_async_signal (-1),
-    m_interrupt_sent (false),
-    m_thread_id_to_used_usec_map (),
-    m_host_arch(),
-    m_process_arch(),
-    m_os_version_major (UINT32_MAX),
-    m_os_version_minor (UINT32_MAX),
-    m_os_version_update (UINT32_MAX),
-    m_os_build (),
-    m_os_kernel (),
-    m_hostname (),
-    m_gdb_server_name(),
-    m_gdb_server_version(UINT32_MAX),
-    m_default_packet_timeout (0),
-    m_max_packet_size (0)
+GDBRemoteCommunicationClient::GDBRemoteCommunicationClient()
+    : GDBRemoteCommunication("gdb-remote.client", "gdb-remote.client.rx_packet"),
+      m_supports_not_sending_acks(eLazyBoolCalculate),
+      m_supports_thread_suffix(eLazyBoolCalculate),
+      m_supports_threads_in_stop_reply(eLazyBoolCalculate),
+      m_supports_vCont_all(eLazyBoolCalculate),
+      m_supports_vCont_any(eLazyBoolCalculate),
+      m_supports_vCont_c(eLazyBoolCalculate),
+      m_supports_vCont_C(eLazyBoolCalculate),
+      m_supports_vCont_s(eLazyBoolCalculate),
+      m_supports_vCont_S(eLazyBoolCalculate),
+      m_qHostInfo_is_valid(eLazyBoolCalculate),
+      m_curr_pid_is_valid(eLazyBoolCalculate),
+      m_qProcessInfo_is_valid(eLazyBoolCalculate),
+      m_qGDBServerVersion_is_valid(eLazyBoolCalculate),
+      m_supports_alloc_dealloc_memory(eLazyBoolCalculate),
+      m_supports_memory_region_info(eLazyBoolCalculate),
+      m_supports_watchpoint_support_info(eLazyBoolCalculate),
+      m_supports_detach_stay_stopped(eLazyBoolCalculate),
+      m_watchpoints_trigger_after_instruction(eLazyBoolCalculate),
+      m_attach_or_wait_reply(eLazyBoolCalculate),
+      m_prepare_for_reg_writing_reply(eLazyBoolCalculate),
+      m_supports_p(eLazyBoolCalculate),
+      m_supports_x(eLazyBoolCalculate),
+      m_avoid_g_packets(eLazyBoolCalculate),
+      m_supports_QSaveRegisterState(eLazyBoolCalculate),
+      m_supports_qXfer_auxv_read(eLazyBoolCalculate),
+      m_supports_qXfer_libraries_read(eLazyBoolCalculate),
+      m_supports_qXfer_libraries_svr4_read(eLazyBoolCalculate),
+      m_supports_qXfer_features_read(eLazyBoolCalculate),
+      m_supports_augmented_libraries_svr4_read(eLazyBoolCalculate),
+      m_supports_jThreadExtendedInfo(eLazyBoolCalculate),
+      m_supports_jLoadedDynamicLibrariesInfos(eLazyBoolCalculate),
+      m_supports_qProcessInfoPID(true),
+      m_supports_qfProcessInfo(true),
+      m_supports_qUserName(true),
+      m_supports_qGroupName(true),
+      m_supports_qThreadStopInfo(true),
+      m_supports_z0(true),
+      m_supports_z1(true),
+      m_supports_z2(true),
+      m_supports_z3(true),
+      m_supports_z4(true),
+      m_supports_QEnvironment(true),
+      m_supports_QEnvironmentHexEncoded(true),
+      m_supports_qSymbol(true),
+      m_qSymbol_requests_done(false),
+      m_supports_qModuleInfo(true),
+      m_supports_jThreadsInfo(true),
+      m_curr_pid(LLDB_INVALID_PROCESS_ID),
+      m_curr_tid(LLDB_INVALID_THREAD_ID),
+      m_curr_tid_run(LLDB_INVALID_THREAD_ID),
+      m_num_supported_hardware_watchpoints(0),
+      m_async_mutex(),
+      m_async_packet_predicate(false),
+      m_async_packet(),
+      m_async_result(PacketResult::Success),
+      m_async_response(),
+      m_async_signal(-1),
+      m_interrupt_sent(false),
+      m_thread_id_to_used_usec_map(),
+      m_host_arch(),
+      m_process_arch(),
+      m_os_version_major(UINT32_MAX),
+      m_os_version_minor(UINT32_MAX),
+      m_os_version_update(UINT32_MAX),
+      m_os_build(),
+      m_os_kernel(),
+      m_hostname(),
+      m_gdb_server_name(),
+      m_gdb_server_version(UINT32_MAX),
+      m_default_packet_timeout(0),
+      m_max_packet_size(0)
 {
 }
 
@@ -820,7 +820,7 @@ GDBRemoteCommunicationClient::SendPacket
         {
             if (IsRunning())
             {
-                Mutex::Locker async_locker (m_async_mutex);
+                std::lock_guard<std::recursive_mutex> guard(m_async_mutex);
                 m_async_packet.assign(payload, payload_length);
                 m_async_response.CopyResponseValidator(response);
                 m_async_packet_predicate.SetValue (true, eBroadcastNever);
@@ -1372,7 +1372,7 @@ GDBRemoteCommunicationClient::SendContin
 bool
 GDBRemoteCommunicationClient::SendAsyncSignal (int signo)
 {
-    Mutex::Locker async_locker (m_async_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_async_mutex);
     m_async_signal = signo;
     bool timed_out = false;
     Mutex::Locker locker;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Tue May 17 20:59:10 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -631,7 +632,7 @@ protected:
 
     // If we need to send a packet while the target is running, the m_async_XXX
     // member variables take care of making this happen.
-    Mutex m_async_mutex;
+    std::recursive_mutex m_async_mutex;
     Predicate<bool> m_async_packet_predicate;
     std::string m_async_packet;
     PacketResult m_async_result;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h Tue May 17 20:59:10 2016
@@ -17,7 +17,6 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private-forward.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 
 #include "GDBRemoteCommunicationServer.h"

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Tue May 17 20:59:10 2016
@@ -76,23 +76,22 @@ namespace
 //----------------------------------------------------------------------
 // GDBRemoteCommunicationServerLLGS constructor
 //----------------------------------------------------------------------
-GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS(
-        const lldb::PlatformSP& platform_sp,
-        MainLoop &mainloop) :
-    GDBRemoteCommunicationServerCommon ("gdb-remote.server", "gdb-remote.server.rx_packet"),
-    m_platform_sp (platform_sp),
-    m_mainloop (mainloop),
-    m_current_tid (LLDB_INVALID_THREAD_ID),
-    m_continue_tid (LLDB_INVALID_THREAD_ID),
-    m_debugged_process_mutex (Mutex::eMutexTypeRecursive),
-    m_debugged_process_sp (),
-    m_stdio_communication ("process.stdio"),
-    m_inferior_prev_state (StateType::eStateInvalid),
-    m_active_auxv_buffer_sp (),
-    m_saved_registers_mutex (),
-    m_saved_registers_map (),
-    m_next_saved_registers_id (1),
-    m_handshake_completed (false)
+GDBRemoteCommunicationServerLLGS::GDBRemoteCommunicationServerLLGS(const lldb::PlatformSP &platform_sp,
+                                                                   MainLoop &mainloop)
+    : GDBRemoteCommunicationServerCommon("gdb-remote.server", "gdb-remote.server.rx_packet"),
+      m_platform_sp(platform_sp),
+      m_mainloop(mainloop),
+      m_current_tid(LLDB_INVALID_THREAD_ID),
+      m_continue_tid(LLDB_INVALID_THREAD_ID),
+      m_debugged_process_mutex(),
+      m_debugged_process_sp(),
+      m_stdio_communication("process.stdio"),
+      m_inferior_prev_state(StateType::eStateInvalid),
+      m_active_auxv_buffer_sp(),
+      m_saved_registers_mutex(),
+      m_saved_registers_map(),
+      m_next_saved_registers_id(1),
+      m_handshake_completed(false)
 {
     assert(platform_sp);
     RegisterPacketHandlers();
@@ -210,7 +209,7 @@ GDBRemoteCommunicationServerLLGS::Launch
 
     Error error;
     {
-        Mutex::Locker locker (m_debugged_process_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_debugged_process_mutex);
         assert (!m_debugged_process_sp && "lldb-gdbserver creating debugged process but one already exists");
         error = NativeProcessProtocol::Launch(
             m_process_launch_info,
@@ -2593,7 +2592,7 @@ GDBRemoteCommunicationServerLLGS::Handle
 
     // Save the register data buffer under the save id.
     {
-        Mutex::Locker locker (m_saved_registers_mutex);
+        std::lock_guard<std::mutex> guard(m_saved_registers_mutex);
         m_saved_registers_map[save_id] = register_data_sp;
     }
 
@@ -2643,7 +2642,7 @@ GDBRemoteCommunicationServerLLGS::Handle
     // Retrieve register state buffer, then remove from the list.
     DataBufferSP register_data_sp;
     {
-        Mutex::Locker locker (m_saved_registers_mutex);
+        std::lock_guard<std::mutex> guard(m_saved_registers_mutex);
 
         // Find the register set buffer for the given save id.
         auto it = m_saved_registers_map.find (save_id);
@@ -2947,7 +2946,7 @@ GDBRemoteCommunicationServerLLGS::GetCur
 uint32_t
 GDBRemoteCommunicationServerLLGS::GetNextSavedRegistersID ()
 {
-    Mutex::Locker locker (m_saved_registers_mutex);
+    std::lock_guard<std::mutex> guard(m_saved_registers_mutex);
     return m_next_saved_registers_id++;
 }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h Tue May 17 20:59:10 2016
@@ -12,12 +12,12 @@
 
 // C Includes
 // C++ Includes
+#include <mutex>
 #include <unordered_map>
 
 // Other libraries and framework includes
 #include "lldb/lldb-private-forward.h"
 #include "lldb/Core/Communication.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Host/common/NativeProcessProtocol.h"
 #include "lldb/Host/MainLoop.h"
 
@@ -119,7 +119,7 @@ protected:
     MainLoop::ReadHandleUP m_network_handle_up;
     lldb::tid_t m_current_tid;
     lldb::tid_t m_continue_tid;
-    Mutex m_debugged_process_mutex;
+    std::recursive_mutex m_debugged_process_mutex;
     NativeProcessProtocolSP m_debugged_process_sp;
 
     Communication m_stdio_communication;
@@ -127,7 +127,7 @@ protected:
 
     lldb::StateType m_inferior_prev_state;
     lldb::DataBufferSP m_active_auxv_buffer_sp;
-    Mutex m_saved_registers_mutex;
+    std::mutex m_saved_registers_mutex;
     std::unordered_map<uint32_t, lldb::DataBufferSP> m_saved_registers_map;
     uint32_t m_next_saved_registers_id;
     bool m_handshake_completed : 1;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Tue May 17 20:59:10 2016
@@ -48,14 +48,14 @@ using namespace lldb_private::process_gd
 // GDBRemoteCommunicationServerPlatform constructor
 //----------------------------------------------------------------------
 GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform(const Socket::SocketProtocol socket_protocol,
-                                                                           const char* socket_scheme) :
-    GDBRemoteCommunicationServerCommon ("gdb-remote.server", "gdb-remote.server.rx_packet"),
-    m_socket_protocol(socket_protocol),
-    m_socket_scheme(socket_scheme),
-    m_spawned_pids_mutex (Mutex::eMutexTypeRecursive),
-    m_platform_sp (Platform::GetHostPlatform ()),
-    m_port_map (),
-    m_port_offset(0)
+                                                                           const char *socket_scheme)
+    : GDBRemoteCommunicationServerCommon("gdb-remote.server", "gdb-remote.server.rx_packet"),
+      m_socket_protocol(socket_protocol),
+      m_socket_scheme(socket_scheme),
+      m_spawned_pids_mutex(),
+      m_platform_sp(Platform::GetHostPlatform()),
+      m_port_map(),
+      m_port_offset(0)
 {
     m_pending_gdb_server.pid = LLDB_INVALID_PROCESS_ID;
     m_pending_gdb_server.port = 0;
@@ -78,11 +78,7 @@ GDBRemoteCommunicationServerPlatform::GD
                                   &GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo);
 
     RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_interrupt,
-                          [this](StringExtractorGDBRemote packet,
-                                 Error &error,
-                                 bool &interrupt,
-                                 bool &quit)
-                          {
+                          [this](StringExtractorGDBRemote packet, Error &error, bool &interrupt, bool &quit) {
                               error.SetErrorString("interrupt received");
                               interrupt = true;
                               return PacketResult::Success;
@@ -156,7 +152,7 @@ GDBRemoteCommunicationServerPlatform::La
     pid = debugserver_launch_info.GetProcessID();
     if (pid != LLDB_INVALID_PROCESS_ID)
     {
-        Mutex::Locker locker (m_spawned_pids_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
         m_spawned_pids.insert(pid);
         if (port > 0)
             AssociatePortWithProcess(port, pid);
@@ -261,7 +257,7 @@ GDBRemoteCommunicationServerPlatform::Ha
     // verify that we know anything about this pid.
     // Scope for locker
     {
-        Mutex::Locker locker (m_spawned_pids_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
         if (m_spawned_pids.find(pid) == m_spawned_pids.end())
         {
             // not a pid we know about
@@ -281,7 +277,7 @@ GDBRemoteCommunicationServerPlatform::Ki
 {
     // make sure we know about this process
     {
-        Mutex::Locker locker (m_spawned_pids_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
         if (m_spawned_pids.find(pid) == m_spawned_pids.end())
             return false;
     }
@@ -293,7 +289,7 @@ GDBRemoteCommunicationServerPlatform::Ki
     for (size_t i=0; i<10; ++i)
     {
         {
-            Mutex::Locker locker (m_spawned_pids_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
             if (m_spawned_pids.find(pid) == m_spawned_pids.end())
             {
                 // it is now killed
@@ -305,7 +301,7 @@ GDBRemoteCommunicationServerPlatform::Ki
 
     // check one more time after the final usleep
     {
-        Mutex::Locker locker (m_spawned_pids_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
         if (m_spawned_pids.find(pid) == m_spawned_pids.end())
             return true;
     }
@@ -317,7 +313,7 @@ GDBRemoteCommunicationServerPlatform::Ki
     for (size_t i=0; i<10; ++i)
     {
         {
-            Mutex::Locker locker (m_spawned_pids_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
             if (m_spawned_pids.find(pid) == m_spawned_pids.end())
             {
                 // it is now killed
@@ -330,7 +326,7 @@ GDBRemoteCommunicationServerPlatform::Ki
     // check one more time after the final usleep
     // Scope for locker
     {
-        Mutex::Locker locker (m_spawned_pids_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
         if (m_spawned_pids.find(pid) == m_spawned_pids.end())
             return true;
     }
@@ -444,7 +440,7 @@ GDBRemoteCommunicationServerPlatform::Ha
 bool
 GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped (lldb::pid_t pid)
 {
-    Mutex::Locker locker (m_spawned_pids_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
     FreePortForProcess(pid);
     m_spawned_pids.erase(pid);
     return true;
@@ -479,7 +475,7 @@ GDBRemoteCommunicationServerPlatform::La
     if (pid != LLDB_INVALID_PROCESS_ID)
     {
         // add to spawned pids
-        Mutex::Locker locker (m_spawned_pids_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_spawned_pids_mutex);
         m_spawned_pids.insert(pid);
     }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h Tue May 17 20:59:10 2016
@@ -13,6 +13,7 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <set>
 
 // Other libraries and framework includes
@@ -82,7 +83,7 @@ public:
 protected:
     const Socket::SocketProtocol m_socket_protocol;
     const std::string m_socket_scheme;
-    Mutex m_spawned_pids_mutex;
+    std::recursive_mutex m_spawned_pids_mutex;
     std::set<lldb::pid_t> m_spawned_pids;
     lldb::PlatformSP m_platform_sp;
 

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=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue May 17 20:59:10 2016
@@ -267,39 +267,39 @@ ProcessGDBRemote::CanDebug (lldb::Target
 //----------------------------------------------------------------------
 // ProcessGDBRemote constructor
 //----------------------------------------------------------------------
-ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp, ListenerSP listener_sp) :
-    Process (target_sp, listener_sp),
-    m_flags (0),
-    m_gdb_comm (),
-    m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
-    m_last_stop_packet_mutex (Mutex::eMutexTypeRecursive),
-    m_register_info (),
-    m_async_broadcaster (NULL, "lldb.process.gdb-remote.async-broadcaster"),
-    m_async_listener_sp(Listener::MakeListener("lldb.process.gdb-remote.async-listener")),
-    m_async_thread_state_mutex(Mutex::eMutexTypeRecursive),
-    m_thread_ids (),
-    m_thread_pcs (),
-    m_jstopinfo_sp (),
-    m_jthreadsinfo_sp (),
-    m_continue_c_tids (),
-    m_continue_C_tids (),
-    m_continue_s_tids (),
-    m_continue_S_tids (),
-    m_max_memory_size (0),
-    m_remote_stub_max_memory_size (0),
-    m_addr_to_mmap_size (),
-    m_thread_create_bp_sp (),
-    m_waiting_for_attach (false),
-    m_destroy_tried_resuming (false),
-    m_command_sp (),
-    m_breakpoint_pc_offset (0),
-    m_initial_tid (LLDB_INVALID_THREAD_ID)
-{
-    m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit,   "async thread should exit");
-    m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue,           "async thread continue");
-    m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadDidExit,      "async thread did exit");
+ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp, ListenerSP listener_sp)
+    : Process(target_sp, listener_sp),
+      m_flags(0),
+      m_gdb_comm(),
+      m_debugserver_pid(LLDB_INVALID_PROCESS_ID),
+      m_last_stop_packet_mutex(),
+      m_register_info(),
+      m_async_broadcaster(NULL, "lldb.process.gdb-remote.async-broadcaster"),
+      m_async_listener_sp(Listener::MakeListener("lldb.process.gdb-remote.async-listener")),
+      m_async_thread_state_mutex(),
+      m_thread_ids(),
+      m_thread_pcs(),
+      m_jstopinfo_sp(),
+      m_jthreadsinfo_sp(),
+      m_continue_c_tids(),
+      m_continue_C_tids(),
+      m_continue_s_tids(),
+      m_continue_S_tids(),
+      m_max_memory_size(0),
+      m_remote_stub_max_memory_size(0),
+      m_addr_to_mmap_size(),
+      m_thread_create_bp_sp(),
+      m_waiting_for_attach(false),
+      m_destroy_tried_resuming(false),
+      m_command_sp(),
+      m_breakpoint_pc_offset(0),
+      m_initial_tid(LLDB_INVALID_THREAD_ID)
+{
+    m_async_broadcaster.SetEventName(eBroadcastBitAsyncThreadShouldExit, "async thread should exit");
+    m_async_broadcaster.SetEventName(eBroadcastBitAsyncContinue, "async thread continue");
+    m_async_broadcaster.SetEventName(eBroadcastBitAsyncThreadDidExit, "async thread did exit");
 
-    Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC));
+    Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_ASYNC));
 
     const uint32_t async_event_mask = eBroadcastBitAsyncContinue | eBroadcastBitAsyncThreadShouldExit;
 
@@ -309,8 +309,8 @@ ProcessGDBRemote::ProcessGDBRemote(lldb:
             log->Printf("ProcessGDBRemote::%s failed to listen for m_async_broadcaster events", __FUNCTION__);
     }
 
-    const uint32_t gdb_event_mask = Communication::eBroadcastBitReadThreadDidExit |
-                                    GDBRemoteCommunication::eBroadcastBitGdbReadThreadGotNotify;
+    const uint32_t gdb_event_mask =
+        Communication::eBroadcastBitReadThreadDidExit | GDBRemoteCommunication::eBroadcastBitGdbReadThreadGotNotify;
     if (m_async_listener_sp->StartListeningForEvents(&m_gdb_comm, gdb_event_mask) != gdb_event_mask)
     {
         if (log)
@@ -1729,8 +1729,8 @@ ProcessGDBRemote::UpdateThreadIDList ()
 
         // Lock the thread stack while we access it
         //Mutex::Locker stop_stack_lock(m_last_stop_packet_mutex);
-        Mutex::Locker stop_stack_lock;
-        if (stop_stack_lock.TryLock(m_last_stop_packet_mutex))
+        std::unique_lock<std::recursive_mutex> stop_stack_lock(m_last_stop_packet_mutex, std::defer_lock);
+        if (stop_stack_lock.try_lock())
         {
             // Get the number of stop packets on the stack
             int nItems = m_stop_packet_stack.size();
@@ -2673,7 +2673,7 @@ ProcessGDBRemote::RefreshStateAfterStop
     // Scope for the lock
     {
         // Lock the thread stack while we access it
-        Mutex::Locker stop_stack_lock(m_last_stop_packet_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_last_stop_packet_mutex);
         // Get the number of stop packets on the stack
         int nItems = m_stop_packet_stack.size();
         // Iterate over them
@@ -2975,7 +2975,7 @@ ProcessGDBRemote::SetLastStopPacket (con
     // Scope the lock
     {
         // Lock the thread stack while we access it
-        Mutex::Locker stop_stack_lock(m_last_stop_packet_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_last_stop_packet_mutex);
 
         // We are are not using non-stop mode, there can only be one last stop
         // reply packet, so clear the list.
@@ -3761,7 +3761,7 @@ ProcessGDBRemote::StartAsyncThread ()
     if (log)
         log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__);
 
-    Mutex::Locker start_locker(m_async_thread_state_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
     if (!m_async_thread.IsJoinable())
     {
         // Create a thread that watches our internal state and controls which
@@ -3783,7 +3783,7 @@ ProcessGDBRemote::StopAsyncThread ()
     if (log)
         log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__);
 
-    Mutex::Locker start_locker(m_async_thread_state_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_async_thread_state_mutex);
     if (m_async_thread.IsJoinable())
     {
         m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncThreadShouldExit);

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Tue May 17 20:59:10 2016
@@ -14,6 +14,7 @@
 // C++ Includes
 #include <atomic>
 #include <map>
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -279,12 +280,12 @@ protected:
     GDBRemoteCommunicationClient m_gdb_comm;
     std::atomic<lldb::pid_t> m_debugserver_pid;
     std::vector<StringExtractorGDBRemote> m_stop_packet_stack;  // The stop packet stack replaces the last stop packet variable
-    Mutex m_last_stop_packet_mutex;
+    std::recursive_mutex m_last_stop_packet_mutex;
     GDBRemoteDynamicRegisterInfo m_register_info;
     Broadcaster m_async_broadcaster;
     lldb::ListenerSP m_async_listener_sp;
     HostThread m_async_thread;
-    Mutex m_async_thread_state_mutex;
+    std::recursive_mutex m_async_thread_state_mutex;
     typedef std::vector<lldb::tid_t> tid_collection;
     typedef std::vector< std::pair<lldb::tid_t,int> > tid_sig_collection;
     typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue May 17 20:59:10 2016
@@ -2069,7 +2069,7 @@ DWARFASTParserClang::CompleteTypeFromDWA
 {
     SymbolFileDWARF *dwarf = die.GetDWARF();
 
-    lldb_private::Mutex::Locker locker(dwarf->GetObjectFile()->GetModule()->GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(dwarf->GetObjectFile()->GetModule()->GetMutex());
 
     // Disable external storage for this type so we don't get anymore
     // clang::ExternalASTSource queries for this type.

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue May 17 20:59:10 2016
@@ -1619,7 +1619,7 @@ SymbolFileDWARF::HasForwardDeclForClangT
 bool
 SymbolFileDWARF::CompleteType (CompilerType &compiler_type)
 {
-    lldb_private::Mutex::Locker locker(GetObjectFile()->GetModule()->GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(GetObjectFile()->GetModule()->GetMutex());
 
     ClangASTContext *clang_type_system = llvm::dyn_cast_or_null<ClangASTContext>(compiler_type.GetTypeSystem());
     if (clang_type_system)

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue May 17 20:59:10 2016
@@ -208,7 +208,7 @@ public:
             ObjectFile *oso_objfile = GetObjectFile ();
             if (oso_objfile)
             {
-                Mutex::Locker locker (m_mutex);
+                std::lock_guard<std::recursive_mutex> guard(m_mutex);
                 SymbolVendor* symbol_vendor = Module::GetSymbolVendor(can_create, feedback_strm);
                 if (symbol_vendor)
                 {

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp Tue May 17 20:59:10 2016
@@ -96,12 +96,12 @@ extern \"C\"
 }                                                                                                               \n\
 ";
 
-AppleGetItemInfoHandler::AppleGetItemInfoHandler (Process *process) :
-    m_process (process),
-    m_get_item_info_impl_code (),
-    m_get_item_info_function_mutex(),
-    m_get_item_info_return_buffer_addr (LLDB_INVALID_ADDRESS),
-    m_get_item_info_retbuffer_mutex()
+AppleGetItemInfoHandler::AppleGetItemInfoHandler(Process *process)
+    : m_process(process),
+      m_get_item_info_impl_code(),
+      m_get_item_info_function_mutex(),
+      m_get_item_info_return_buffer_addr(LLDB_INVALID_ADDRESS),
+      m_get_item_info_retbuffer_mutex()
 {
 }
 
@@ -110,14 +110,14 @@ AppleGetItemInfoHandler::~AppleGetItemIn
 }
 
 void
-AppleGetItemInfoHandler::Detach ()
+AppleGetItemInfoHandler::Detach()
 {
 
     if (m_process && m_process->IsAlive() && m_get_item_info_return_buffer_addr != LLDB_INVALID_ADDRESS)
     {
-        Mutex::Locker locker;
-        locker.TryLock (m_get_item_info_retbuffer_mutex);  // Even if we don't get the lock, deallocate the buffer
-        m_process->DeallocateMemory (m_get_item_info_return_buffer_addr);
+        std::unique_lock<std::mutex> lock(m_get_item_info_retbuffer_mutex, std::defer_lock);
+        lock.try_lock(); // Even if we don't get the lock, deallocate the buffer
+        m_process->DeallocateMemory(m_get_item_info_return_buffer_addr);
     }
 }
 
@@ -143,8 +143,8 @@ AppleGetItemInfoHandler::SetupGetItemInf
 
     // Scope for mutex locker:
     {
-        Mutex::Locker locker(m_get_item_info_function_mutex);
-        
+        std::lock_guard<std::mutex> guard(m_get_item_info_function_mutex);
+
         // First stage is to make the UtilityFunction to hold our injected function:
 
         if (!m_get_item_info_impl_code.get())
@@ -296,8 +296,7 @@ AppleGetItemInfoHandler::GetItemInfo (Th
     page_to_free_size_value.SetValueType (Value::eValueTypeScalar);
     page_to_free_size_value.SetCompilerType (clang_uint64_type);
 
-
-    Mutex::Locker locker(m_get_item_info_retbuffer_mutex);
+    std::lock_guard<std::mutex> guard(m_get_item_info_retbuffer_mutex);
     if (m_get_item_info_return_buffer_addr == LLDB_INVALID_ADDRESS)
     {
         addr_t bufaddr = process_sp->AllocateMemory (32, ePermissionsReadable | ePermissionsWritable, error);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.h Tue May 17 20:59:10 2016
@@ -13,13 +13,14 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <vector>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Expression/UtilityFunction.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/CompilerType.h"
 
 // This class will insert a UtilityFunction into the inferior process for
@@ -105,11 +106,10 @@ private:
 
     lldb_private::Process *m_process;
     std::unique_ptr<UtilityFunction> m_get_item_info_impl_code;
-    Mutex m_get_item_info_function_mutex;
+    std::mutex m_get_item_info_function_mutex;
 
     lldb::addr_t m_get_item_info_return_buffer_addr;
-    Mutex m_get_item_info_retbuffer_mutex;
-
+    std::mutex m_get_item_info_retbuffer_mutex;
 };
 
 }  // using namespace lldb_private

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp Tue May 17 20:59:10 2016
@@ -100,12 +100,12 @@ extern \"C\"
 }                                                                                                               \n\
 ";
 
-AppleGetPendingItemsHandler::AppleGetPendingItemsHandler (Process *process) :
-    m_process (process),
-    m_get_pending_items_impl_code (),
-    m_get_pending_items_function_mutex(),
-    m_get_pending_items_return_buffer_addr (LLDB_INVALID_ADDRESS),
-    m_get_pending_items_retbuffer_mutex()
+AppleGetPendingItemsHandler::AppleGetPendingItemsHandler(Process *process)
+    : m_process(process),
+      m_get_pending_items_impl_code(),
+      m_get_pending_items_function_mutex(),
+      m_get_pending_items_return_buffer_addr(LLDB_INVALID_ADDRESS),
+      m_get_pending_items_retbuffer_mutex()
 {
 }
 
@@ -114,14 +114,13 @@ AppleGetPendingItemsHandler::~AppleGetPe
 }
 
 void
-AppleGetPendingItemsHandler::Detach ()
+AppleGetPendingItemsHandler::Detach()
 {
-
     if (m_process && m_process->IsAlive() && m_get_pending_items_return_buffer_addr != LLDB_INVALID_ADDRESS)
     {
-        Mutex::Locker locker;
-        locker.TryLock (m_get_pending_items_retbuffer_mutex);  // Even if we don't get the lock, deallocate the buffer
-        m_process->DeallocateMemory (m_get_pending_items_return_buffer_addr);
+        std::unique_lock<std::mutex> lock(m_get_pending_items_retbuffer_mutex, std::defer_lock);
+        lock.try_lock(); // Even if we don't get the lock, deallocate the buffer
+        m_process->DeallocateMemory(m_get_pending_items_return_buffer_addr);
     }
 }
 
@@ -149,8 +148,8 @@ AppleGetPendingItemsHandler::SetupGetPen
 
     // Scope for mutex locker:
     {
-        Mutex::Locker locker(m_get_pending_items_function_mutex);
-        
+        std::lock_guard<std::mutex> guard(m_get_pending_items_function_mutex);
+
         // First stage is to make the ClangUtility to hold our injected function:
 
         if (!m_get_pending_items_impl_code.get())
@@ -298,8 +297,7 @@ AppleGetPendingItemsHandler::GetPendingI
     page_to_free_size_value.SetValueType (Value::eValueTypeScalar);
     page_to_free_size_value.SetCompilerType (clang_uint64_type);
 
-
-    Mutex::Locker locker(m_get_pending_items_retbuffer_mutex);
+    std::lock_guard<std::mutex> guard(m_get_pending_items_retbuffer_mutex);
     if (m_get_pending_items_return_buffer_addr == LLDB_INVALID_ADDRESS)
     {
         addr_t bufaddr = process_sp->AllocateMemory (32, ePermissionsReadable | ePermissionsWritable, error);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h Tue May 17 20:59:10 2016
@@ -13,12 +13,13 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <vector>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Core/Error.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/CompilerType.h"
 
 // This class will insert a UtilityFunction into the inferior process for
@@ -107,11 +108,10 @@ private:
 
     lldb_private::Process *m_process;
     std::unique_ptr<UtilityFunction> m_get_pending_items_impl_code;
-    Mutex m_get_pending_items_function_mutex;
+    std::mutex m_get_pending_items_function_mutex;
 
     lldb::addr_t m_get_pending_items_return_buffer_addr;
-    Mutex m_get_pending_items_retbuffer_mutex;
-
+    std::mutex m_get_pending_items_retbuffer_mutex;
 };
 
 }  // using namespace lldb_private

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp Tue May 17 20:59:10 2016
@@ -96,12 +96,12 @@ extern \"C\"
 }                                                                                                               \n\
 ";
 
-AppleGetQueuesHandler::AppleGetQueuesHandler (Process *process) :
-    m_process (process),
-    m_get_queues_impl_code_up (),
-    m_get_queues_function_mutex(),
-    m_get_queues_return_buffer_addr (LLDB_INVALID_ADDRESS),
-    m_get_queues_retbuffer_mutex()
+AppleGetQueuesHandler::AppleGetQueuesHandler(Process *process)
+    : m_process(process),
+      m_get_queues_impl_code_up(),
+      m_get_queues_function_mutex(),
+      m_get_queues_return_buffer_addr(LLDB_INVALID_ADDRESS),
+      m_get_queues_retbuffer_mutex()
 {
 }
 
@@ -110,14 +110,14 @@ AppleGetQueuesHandler::~AppleGetQueuesHa
 }
 
 void
-AppleGetQueuesHandler::Detach ()
+AppleGetQueuesHandler::Detach()
 {
 
     if (m_process && m_process->IsAlive() && m_get_queues_return_buffer_addr != LLDB_INVALID_ADDRESS)
     {
-        Mutex::Locker locker;
-        locker.TryLock (m_get_queues_retbuffer_mutex);  // Even if we don't get the lock, deallocate the buffer
-        m_process->DeallocateMemory (m_get_queues_return_buffer_addr);
+        std::unique_lock<std::mutex> lock(m_get_queues_retbuffer_mutex, std::defer_lock);
+        lock.try_lock(); // Even if we don't get the lock, deallocate the buffer
+        m_process->DeallocateMemory(m_get_queues_return_buffer_addr);
     }
 }
 
@@ -159,8 +159,8 @@ AppleGetQueuesHandler::SetupGetQueuesFun
 
     // Scope for mutex locker:
     {
-        Mutex::Locker locker(m_get_queues_function_mutex);
-        
+        std::lock_guard<std::mutex> guard(m_get_queues_function_mutex);
+
         // First stage is to make the ClangUtility to hold our injected function:
 
         if (!m_get_queues_impl_code_up.get())
@@ -297,8 +297,7 @@ AppleGetQueuesHandler::GetCurrentQueues
     page_to_free_size_value.SetValueType (Value::eValueTypeScalar);
     page_to_free_size_value.SetCompilerType (clang_uint64_type);
 
-
-    Mutex::Locker locker(m_get_queues_retbuffer_mutex);
+    std::lock_guard<std::mutex> guard(m_get_queues_retbuffer_mutex);
     if (m_get_queues_return_buffer_addr == LLDB_INVALID_ADDRESS)
     {
         addr_t bufaddr = process_sp->AllocateMemory (32, ePermissionsReadable | ePermissionsWritable, error);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h Tue May 17 20:59:10 2016
@@ -13,12 +13,13 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <vector>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Core/Error.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/CompilerType.h"
 
 // This class will insert a UtilityFunction into the inferior process for
@@ -104,11 +105,10 @@ private:
 
     lldb_private::Process *m_process;
     std::unique_ptr<UtilityFunction> m_get_queues_impl_code_up;
-    Mutex m_get_queues_function_mutex;
+    std::mutex m_get_queues_function_mutex;
 
     lldb::addr_t m_get_queues_return_buffer_addr;
-    Mutex m_get_queues_retbuffer_mutex;
-
+    std::mutex m_get_queues_retbuffer_mutex;
 };
 
 }  // using namespace lldb_private

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp Tue May 17 20:59:10 2016
@@ -103,12 +103,12 @@ extern \"C\"
 }                                                                                                               \n\
 ";
 
-AppleGetThreadItemInfoHandler::AppleGetThreadItemInfoHandler (Process *process) :
-    m_process (process),
-    m_get_thread_item_info_impl_code (),
-    m_get_thread_item_info_function_mutex(),
-    m_get_thread_item_info_return_buffer_addr (LLDB_INVALID_ADDRESS),
-    m_get_thread_item_info_retbuffer_mutex()
+AppleGetThreadItemInfoHandler::AppleGetThreadItemInfoHandler(Process *process)
+    : m_process(process),
+      m_get_thread_item_info_impl_code(),
+      m_get_thread_item_info_function_mutex(),
+      m_get_thread_item_info_return_buffer_addr(LLDB_INVALID_ADDRESS),
+      m_get_thread_item_info_retbuffer_mutex()
 {
 }
 
@@ -117,14 +117,14 @@ AppleGetThreadItemInfoHandler::~AppleGet
 }
 
 void
-AppleGetThreadItemInfoHandler::Detach ()
+AppleGetThreadItemInfoHandler::Detach()
 {
 
     if (m_process && m_process->IsAlive() && m_get_thread_item_info_return_buffer_addr != LLDB_INVALID_ADDRESS)
     {
-        Mutex::Locker locker;
-        locker.TryLock (m_get_thread_item_info_retbuffer_mutex);  // Even if we don't get the lock, deallocate the buffer
-        m_process->DeallocateMemory (m_get_thread_item_info_return_buffer_addr);
+        std::unique_lock<std::mutex> lock(m_get_thread_item_info_retbuffer_mutex, std::defer_lock);
+        lock.try_lock(); // Even if we don't get the lock, deallocate the buffer
+        m_process->DeallocateMemory(m_get_thread_item_info_return_buffer_addr);
     }
 }
 
@@ -152,8 +152,8 @@ AppleGetThreadItemInfoHandler::SetupGetT
 
     // Scope for mutex locker:
     {
-        Mutex::Locker locker(m_get_thread_item_info_function_mutex);
-        
+        std::lock_guard<std::mutex> guard(m_get_thread_item_info_function_mutex);
+
         // First stage is to make the ClangUtility to hold our injected function:
 
         if (!m_get_thread_item_info_impl_code.get())
@@ -300,8 +300,7 @@ AppleGetThreadItemInfoHandler::GetThread
     page_to_free_size_value.SetValueType (Value::eValueTypeScalar);
     page_to_free_size_value.SetCompilerType (clang_uint64_type);
 
-
-    Mutex::Locker locker(m_get_thread_item_info_retbuffer_mutex);
+    std::lock_guard<std::mutex> guard(m_get_thread_item_info_retbuffer_mutex);
     if (m_get_thread_item_info_return_buffer_addr == LLDB_INVALID_ADDRESS)
     {
         addr_t bufaddr = process_sp->AllocateMemory (32, ePermissionsReadable | ePermissionsWritable, error);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.h Tue May 17 20:59:10 2016
@@ -13,12 +13,13 @@
 // C Includes
 // C++ Includes
 #include <map>
+#include <mutex>
 #include <vector>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-public.h"
 #include "lldb/Core/Error.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Symbol/CompilerType.h"
 
 // This class will insert a UtilityFunction into the inferior process for
@@ -101,11 +102,10 @@ private:
 
     lldb_private::Process *m_process;
     std::unique_ptr<UtilityFunction> m_get_thread_item_info_impl_code;
-    Mutex m_get_thread_item_info_function_mutex;
+    std::mutex m_get_thread_item_info_function_mutex;
 
     lldb::addr_t m_get_thread_item_info_return_buffer_addr;
-    Mutex m_get_thread_item_info_retbuffer_mutex;
-
+    std::mutex m_get_thread_item_info_retbuffer_mutex;
 };
 
 }  // using namespace lldb_private

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Tue May 17 20:59:10 2016
@@ -83,25 +83,25 @@ SystemRuntimeMacOSX::CreateInstance (Pro
 //----------------------------------------------------------------------
 // Constructor
 //----------------------------------------------------------------------
-SystemRuntimeMacOSX::SystemRuntimeMacOSX (Process* process) :
-    SystemRuntime(process),
-    m_break_id(LLDB_INVALID_BREAK_ID),
-    m_mutex(Mutex::eMutexTypeRecursive),
-    m_get_queues_handler(process),
-    m_get_pending_items_handler(process),
-    m_get_item_info_handler(process),
-    m_get_thread_item_info_handler(process),
-    m_page_to_free(LLDB_INVALID_ADDRESS),
-    m_page_to_free_size(0),
-    m_lib_backtrace_recording_info(),
-    m_dispatch_queue_offsets_addr (LLDB_INVALID_ADDRESS),
-    m_libdispatch_offsets(),
-    m_libpthread_layout_offsets_addr (LLDB_INVALID_ADDRESS),
-    m_libpthread_offsets(),
-    m_dispatch_tsd_indexes_addr (LLDB_INVALID_ADDRESS),
-    m_libdispatch_tsd_indexes(),
-    m_dispatch_voucher_offsets_addr (LLDB_INVALID_ADDRESS),
-    m_libdispatch_voucher_offsets()
+SystemRuntimeMacOSX::SystemRuntimeMacOSX(Process *process)
+    : SystemRuntime(process),
+      m_break_id(LLDB_INVALID_BREAK_ID),
+      m_mutex(),
+      m_get_queues_handler(process),
+      m_get_pending_items_handler(process),
+      m_get_item_info_handler(process),
+      m_get_thread_item_info_handler(process),
+      m_page_to_free(LLDB_INVALID_ADDRESS),
+      m_page_to_free_size(0),
+      m_lib_backtrace_recording_info(),
+      m_dispatch_queue_offsets_addr(LLDB_INVALID_ADDRESS),
+      m_libdispatch_offsets(),
+      m_libpthread_layout_offsets_addr(LLDB_INVALID_ADDRESS),
+      m_libpthread_offsets(),
+      m_dispatch_tsd_indexes_addr(LLDB_INVALID_ADDRESS),
+      m_libdispatch_tsd_indexes(),
+      m_dispatch_voucher_offsets_addr(LLDB_INVALID_ADDRESS),
+      m_libdispatch_voucher_offsets()
 {
 }
 
@@ -128,7 +128,7 @@ SystemRuntimeMacOSX::Detach ()
 void
 SystemRuntimeMacOSX::Clear (bool clear_process)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     if (m_process->IsAlive() && LLDB_BREAK_ID_IS_VALID(m_break_id))
         m_process->ClearBreakpointSiteByID(m_break_id);

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h Tue May 17 20:59:10 2016
@@ -12,8 +12,9 @@
 
 // C Includes
 // C++ Includes
-#include <vector>
+#include <mutex>
 #include <string>
+#include <vector>
 
 // Other libraries and framework include
 // Project includes
@@ -23,7 +24,6 @@
 #include "lldb/Core/StructuredData.h"
 #include "lldb/Core/UUID.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Mutex.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/QueueItem.h"
 
@@ -124,7 +124,7 @@ public:
 
 protected:
     lldb::user_id_t m_break_id;
-    mutable lldb_private::Mutex m_mutex;
+    mutable std::recursive_mutex m_mutex;
 
 private:
     struct libBacktraceRecording_info {

Modified: lldb/trunk/source/Symbol/FuncUnwinders.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/FuncUnwinders.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/FuncUnwinders.cpp (original)
+++ lldb/trunk/source/Symbol/FuncUnwinders.cpp Tue May 17 20:59:10 2016
@@ -30,27 +30,27 @@ using namespace lldb_private;
 /// constructor
 //------------------------------------------------
 
-FuncUnwinders::FuncUnwinders (UnwindTable& unwind_table, AddressRange range) : 
-    m_unwind_table (unwind_table), 
-    m_range (range), 
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_unwind_plan_assembly_sp (),
-    m_unwind_plan_eh_frame_sp (),
-    m_unwind_plan_eh_frame_augmented_sp (),
-    m_unwind_plan_compact_unwind (),
-    m_unwind_plan_arm_unwind_sp (),
-    m_unwind_plan_fast_sp (), 
-    m_unwind_plan_arch_default_sp (), 
-    m_unwind_plan_arch_default_at_func_entry_sp (),
-    m_tried_unwind_plan_assembly (false),
-    m_tried_unwind_plan_eh_frame (false),
-    m_tried_unwind_plan_eh_frame_augmented (false),
-    m_tried_unwind_plan_compact_unwind (false),
-    m_tried_unwind_plan_arm_unwind (false),
-    m_tried_unwind_fast (false),
-    m_tried_unwind_arch_default (false),
-    m_tried_unwind_arch_default_at_func_entry (false),
-    m_first_non_prologue_insn ()
+FuncUnwinders::FuncUnwinders(UnwindTable &unwind_table, AddressRange range)
+    : m_unwind_table(unwind_table),
+      m_range(range),
+      m_mutex(),
+      m_unwind_plan_assembly_sp(),
+      m_unwind_plan_eh_frame_sp(),
+      m_unwind_plan_eh_frame_augmented_sp(),
+      m_unwind_plan_compact_unwind(),
+      m_unwind_plan_arm_unwind_sp(),
+      m_unwind_plan_fast_sp(),
+      m_unwind_plan_arch_default_sp(),
+      m_unwind_plan_arch_default_at_func_entry_sp(),
+      m_tried_unwind_plan_assembly(false),
+      m_tried_unwind_plan_eh_frame(false),
+      m_tried_unwind_plan_eh_frame_augmented(false),
+      m_tried_unwind_plan_compact_unwind(false),
+      m_tried_unwind_plan_arm_unwind(false),
+      m_tried_unwind_fast(false),
+      m_tried_unwind_arch_default(false),
+      m_tried_unwind_arch_default_at_func_entry(false),
+      m_first_non_prologue_insn()
 {
 }
 
@@ -65,7 +65,7 @@ FuncUnwinders::~FuncUnwinders ()
 UnwindPlanSP
 FuncUnwinders::GetUnwindPlanAtCallSite (Target &target, int current_offset)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
     UnwindPlanSP unwind_plan_sp = GetEHFrameUnwindPlan (target, current_offset);
     if (unwind_plan_sp)
@@ -90,7 +90,7 @@ FuncUnwinders::GetCompactUnwindUnwindPla
     if (m_tried_unwind_plan_compact_unwind)
         return UnwindPlanSP();
 
-    Mutex::Locker lock (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_plan_compact_unwind = true;
     if (m_range.GetBaseAddress().IsValid())
     {
@@ -117,7 +117,7 @@ FuncUnwinders::GetEHFrameUnwindPlan (Tar
     if (m_unwind_plan_eh_frame_sp.get() || m_tried_unwind_plan_eh_frame)
         return m_unwind_plan_eh_frame_sp;
 
-    Mutex::Locker lock (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_plan_eh_frame = true;
     if (m_range.GetBaseAddress().IsValid())
     {
@@ -141,7 +141,7 @@ FuncUnwinders::GetArmUnwindUnwindPlan (T
     if (m_unwind_plan_arm_unwind_sp.get() || m_tried_unwind_plan_arm_unwind)
         return m_unwind_plan_arm_unwind_sp;
 
-    Mutex::Locker lock (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_plan_arm_unwind = true;
     if (m_range.GetBaseAddress().IsValid())
     {
@@ -175,7 +175,7 @@ FuncUnwinders::GetEHFrameAugmentedUnwind
             return m_unwind_plan_eh_frame_augmented_sp;
     }
 
-    Mutex::Locker lock (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_plan_eh_frame_augmented = true;
 
     UnwindPlanSP eh_frame_plan = GetEHFrameUnwindPlan (target, current_offset);
@@ -213,7 +213,7 @@ FuncUnwinders::GetAssemblyUnwindPlan (Ta
         return m_unwind_plan_assembly_sp;
     }
 
-    Mutex::Locker lock (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_plan_assembly = true;
 
     UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
@@ -246,7 +246,7 @@ FuncUnwinders::GetUnwindPlanFastUnwind (
     if (m_unwind_plan_fast_sp.get() || m_tried_unwind_fast)
         return m_unwind_plan_fast_sp;
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_fast = true;
 
     UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
@@ -267,7 +267,7 @@ FuncUnwinders::GetUnwindPlanArchitecture
     if (m_unwind_plan_arch_default_sp.get() || m_tried_unwind_arch_default)
         return m_unwind_plan_arch_default_sp;
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_arch_default = true;
 
     Address current_pc;
@@ -294,7 +294,7 @@ FuncUnwinders::GetUnwindPlanArchitecture
     if (m_unwind_plan_arch_default_at_func_entry_sp.get() || m_tried_unwind_arch_default_at_func_entry)
         return m_unwind_plan_arch_default_at_func_entry_sp;
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_tried_unwind_arch_default_at_func_entry = true;
 
     Address current_pc;
@@ -322,7 +322,7 @@ FuncUnwinders::GetFirstNonPrologueInsn (
     if (m_first_non_prologue_insn.IsValid())
         return m_first_non_prologue_insn;
 
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     ExecutionContext exe_ctx (target.shared_from_this(), false);
     UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
     if (assembly_profiler_sp)

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Tue May 17 20:59:10 2016
@@ -600,7 +600,7 @@ ObjectFile::ClearSymtab ()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
         if (log)
             log->Printf ("%p ObjectFile::ClearSymtab () symtab = %p",
@@ -620,7 +620,7 @@ ObjectFile::GetSectionList(bool update_m
             ModuleSP module_sp(GetModule());
             if (module_sp)
             {
-                lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+                std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
                 CreateSections(*module_sp->GetUnifiedSectionList());
             }
         }

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Tue May 17 20:59:10 2016
@@ -85,7 +85,7 @@ SymbolVendor::AddSymbolFileRepresentatio
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (objfile_sp)
         {
             m_objfile_sp = objfile_sp;
@@ -100,7 +100,7 @@ SymbolVendor::SetCompileUnitAtIndex (siz
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         const size_t num_compile_units = GetNumCompileUnits();
         if (idx < num_compile_units)
         {
@@ -129,7 +129,7 @@ SymbolVendor::GetNumCompileUnits()
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_compile_units.empty())
         {
             if (m_sym_file_ap.get())
@@ -151,7 +151,7 @@ SymbolVendor::ParseCompileUnitLanguage (
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseCompileUnitLanguage(sc);
     }
@@ -165,7 +165,7 @@ SymbolVendor::ParseCompileUnitFunctions
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseCompileUnitFunctions(sc);
     }
@@ -178,7 +178,7 @@ SymbolVendor::ParseCompileUnitLineTable
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseCompileUnitLineTable(sc);
     }
@@ -191,7 +191,7 @@ SymbolVendor::ParseCompileUnitDebugMacro
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseCompileUnitDebugMacros(sc);
     }
@@ -203,7 +203,7 @@ SymbolVendor::ParseCompileUnitSupportFil
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseCompileUnitSupportFiles(sc, support_files);
     }
@@ -217,7 +217,7 @@ SymbolVendor::ParseImportedModules (cons
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseImportedModules(sc, imported_modules);
     }
@@ -231,7 +231,7 @@ SymbolVendor::ParseFunctionBlocks (const
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseFunctionBlocks(sc);
     }
@@ -244,7 +244,7 @@ SymbolVendor::ParseTypes (const SymbolCo
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseTypes(sc);
     }
@@ -257,7 +257,7 @@ SymbolVendor::ParseVariablesForContext (
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ParseVariablesForContext(sc);
     }
@@ -270,7 +270,7 @@ SymbolVendor::ResolveTypeUID(lldb::user_
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ResolveTypeUID(type_uid);
     }
@@ -284,7 +284,7 @@ SymbolVendor::ResolveSymbolContext (cons
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ResolveSymbolContext(so_addr, resolve_scope, sc);
     }
@@ -297,7 +297,7 @@ SymbolVendor::ResolveSymbolContext (cons
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->ResolveSymbolContext(file_spec, line, check_inlines, resolve_scope, sc_list);
     }
@@ -310,7 +310,7 @@ SymbolVendor::FindGlobalVariables (const
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->FindGlobalVariables(name, parent_decl_ctx, append, max_matches, variables);
     }
@@ -323,7 +323,7 @@ SymbolVendor::FindGlobalVariables (const
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->FindGlobalVariables(regex, append, max_matches, variables);
     }
@@ -336,7 +336,7 @@ SymbolVendor::FindFunctions(const ConstS
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->FindFunctions(name, parent_decl_ctx, name_type_mask, include_inlines, append, sc_list);
     }
@@ -349,7 +349,7 @@ SymbolVendor::FindFunctions(const Regula
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->FindFunctions(regex, include_inlines, append, sc_list);
     }
@@ -363,7 +363,7 @@ SymbolVendor::FindTypes (const SymbolCon
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->FindTypes(sc, name, parent_decl_ctx, append, max_matches, searched_symbol_files, types);
     }
@@ -378,7 +378,7 @@ SymbolVendor::FindTypes (const std::vect
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->FindTypes(context, append, types);
     }
@@ -395,7 +395,7 @@ SymbolVendor::GetTypes (SymbolContextSco
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             return m_sym_file_ap->GetTypes (sc_scope, type_mask, type_list);
     }
@@ -409,7 +409,7 @@ SymbolVendor::FindNamespace(const Symbol
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         if (m_sym_file_ap.get())
             namespace_decl_ctx = m_sym_file_ap->FindNamespace (sc, name, parent_decl_ctx);
     }
@@ -422,7 +422,7 @@ SymbolVendor::Dump(Stream *s)
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
 
         bool show_context = false;
 
@@ -467,7 +467,7 @@ SymbolVendor::GetCompileUnitAtIndex(size
     ModuleSP module_sp(GetModule());
     if (module_sp)
     {
-        lldb_private::Mutex::Locker locker(module_sp->GetMutex());
+        std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
         const size_t num_compile_units = GetNumCompileUnits();
         if (idx < num_compile_units)
         {

Modified: lldb/trunk/source/Target/JITLoaderList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/JITLoaderList.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/JITLoaderList.cpp (original)
+++ lldb/trunk/source/Target/JITLoaderList.cpp Tue May 17 20:59:10 2016
@@ -14,8 +14,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-JITLoaderList::JITLoaderList()
-    : m_jit_loaders_vec(), m_jit_loaders_mutex(Mutex::eMutexTypeRecursive)
+JITLoaderList::JITLoaderList() : m_jit_loaders_vec(), m_jit_loaders_mutex()
 {
 }
 
@@ -26,14 +25,14 @@ JITLoaderList::~JITLoaderList()
 void
 JITLoaderList::Append (const JITLoaderSP &jit_loader_sp)
 {
-    Mutex::Locker locker(m_jit_loaders_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
     m_jit_loaders_vec.push_back(jit_loader_sp);
 }
 
 void
 JITLoaderList::Remove (const JITLoaderSP &jit_loader_sp)
 {
-    Mutex::Locker locker(m_jit_loaders_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
     m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(),
                                         m_jit_loaders_vec.end(), jit_loader_sp),
                             m_jit_loaders_vec.end());
@@ -48,14 +47,14 @@ JITLoaderList::GetSize() const
 JITLoaderSP
 JITLoaderList::GetLoaderAtIndex (size_t idx)
 {
-    Mutex::Locker locker(m_jit_loaders_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
     return m_jit_loaders_vec[idx];
 }
 
 void
 JITLoaderList::DidLaunch()
 {
-    Mutex::Locker locker(m_jit_loaders_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
     for (auto const &jit_loader : m_jit_loaders_vec)
         jit_loader->DidLaunch();
 }
@@ -63,7 +62,7 @@ JITLoaderList::DidLaunch()
 void
 JITLoaderList::DidAttach()
 {
-    Mutex::Locker locker(m_jit_loaders_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
     for (auto const &jit_loader : m_jit_loaders_vec)
         jit_loader->DidAttach();
 }
@@ -71,7 +70,7 @@ JITLoaderList::DidAttach()
 void
 JITLoaderList::ModulesDidLoad(ModuleList &module_list)
 {
-    Mutex::Locker locker(m_jit_loaders_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
     for (auto const &jit_loader : m_jit_loaders_vec)
         jit_loader->ModulesDidLoad(module_list);
 }

Modified: lldb/trunk/source/Target/Language.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Tue May 17 20:59:10 2016
@@ -36,23 +36,23 @@ GetLanguagesMap ()
     
     return *g_map;
 }
-static Mutex&
-GetLanguagesMutex ()
+static std::mutex &
+GetLanguagesMutex()
 {
-    static Mutex *g_mutex = nullptr;
+    static std::mutex *g_mutex = nullptr;
     static std::once_flag g_initialize;
-    
+
     std::call_once(g_initialize, [] {
-        g_mutex = new Mutex(); // NOTE: INTENTIONAL LEAK due to global destructor chain
+        g_mutex = new std::mutex(); // NOTE: INTENTIONAL LEAK due to global destructor chain
     });
-    
+
     return *g_mutex;
 }
 
 Language*
 Language::FindPlugin (lldb::LanguageType language)
 {
-    Mutex::Locker locker(GetLanguagesMutex());
+    std::lock_guard<std::mutex> guard(GetLanguagesMutex());
     LanguagesMap& map(GetLanguagesMap());
     auto iter = map.find(language), end = map.end();
     if (iter != end)
@@ -80,7 +80,7 @@ Language::FindPlugin (lldb::LanguageType
 void
 Language::ForEach (std::function<bool(Language*)> callback)
 {
-    Mutex::Locker locker(GetLanguagesMutex());
+    std::lock_guard<std::mutex> guard(GetLanguagesMutex());
     LanguagesMap& map(GetLanguagesMap());
     for (const auto& entry : map)
     {

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Tue May 17 20:59:10 2016
@@ -162,10 +162,10 @@ GetPlatformList()
     return g_platform_list;
 }
 
-static Mutex &
-GetPlatformListMutex ()
+static std::recursive_mutex &
+GetPlatformListMutex()
 {
-    static Mutex g_mutex(Mutex::eMutexTypeRecursive);
+    static std::recursive_mutex g_mutex;
     return g_mutex;
 }
 
@@ -182,7 +182,7 @@ Platform::Terminate ()
     {
         if (--g_initialize_count == 0)
         {
-            Mutex::Locker locker(GetPlatformListMutex ());
+            std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
             GetPlatformList().clear();
         }
     }
@@ -204,7 +204,7 @@ Platform::SetHostPlatform (const lldb::P
 
     if (platform_sp)
     {
-        Mutex::Locker locker(GetPlatformListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
         GetPlatformList().push_back(platform_sp);
     }
 }
@@ -309,7 +309,7 @@ Platform::Find (const ConstString &name)
         if (name == g_host_platform_name)
             return GetHostPlatform();
 
-        Mutex::Locker locker(GetPlatformListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
         for (const auto &platform_sp : GetPlatformList())
         {
             if (platform_sp->GetName() == name)
@@ -341,7 +341,7 @@ Platform::Create (const ConstString &nam
 
     if (platform_sp)
     {
-        Mutex::Locker locker(GetPlatformListMutex ());
+        std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
         GetPlatformList().push_back(platform_sp);
     }
 
@@ -357,7 +357,7 @@ Platform::Create (const ArchSpec &arch,
         // Scope for locker
         {
             // First try exact arch matches across all platforms already created
-            Mutex::Locker locker(GetPlatformListMutex ());
+            std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
             for (const auto &platform_sp : GetPlatformList())
             {
                 if (platform_sp->IsCompatibleArchitecture(arch, true, platform_arch_ptr))
@@ -382,7 +382,7 @@ Platform::Create (const ArchSpec &arch,
                 platform_sp = create_callback(false, &arch);
                 if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, true, platform_arch_ptr))
                 {
-                    Mutex::Locker locker(GetPlatformListMutex ());
+                    std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
                     GetPlatformList().push_back(platform_sp);
                     return platform_sp;
                 }
@@ -396,7 +396,7 @@ Platform::Create (const ArchSpec &arch,
                 platform_sp = create_callback(false, &arch);
                 if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, false, platform_arch_ptr))
                 {
-                    Mutex::Locker locker(GetPlatformListMutex ());
+                    std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
                     GetPlatformList().push_back(platform_sp);
                     return platform_sp;
                 }
@@ -414,37 +414,37 @@ Platform::Create (const ArchSpec &arch,
 //------------------------------------------------------------------
 /// Default Constructor
 //------------------------------------------------------------------
-Platform::Platform (bool is_host) :
-    m_is_host (is_host),
-    m_os_version_set_while_connected (false),
-    m_system_arch_set_while_connected (false),
-    m_sdk_sysroot (),
-    m_sdk_build (),
-    m_working_dir (),
-    m_remote_url (),
-    m_name (),
-    m_major_os_version (UINT32_MAX),
-    m_minor_os_version (UINT32_MAX),
-    m_update_os_version (UINT32_MAX),
-    m_system_arch(),
-    m_mutex (Mutex::eMutexTypeRecursive),
-    m_uid_map(),
-    m_gid_map(),
-    m_max_uid_name_len (0),
-    m_max_gid_name_len (0),
-    m_supports_rsync (false),
-    m_rsync_opts (),
-    m_rsync_prefix (),
-    m_supports_ssh (false),
-    m_ssh_opts (),
-    m_ignores_remote_hostname (false),
-    m_trap_handlers(),
-    m_calculated_trap_handlers (false),
-    m_module_cache (llvm::make_unique<ModuleCache> ())
+Platform::Platform(bool is_host)
+    : m_is_host(is_host),
+      m_os_version_set_while_connected(false),
+      m_system_arch_set_while_connected(false),
+      m_sdk_sysroot(),
+      m_sdk_build(),
+      m_working_dir(),
+      m_remote_url(),
+      m_name(),
+      m_major_os_version(UINT32_MAX),
+      m_minor_os_version(UINT32_MAX),
+      m_update_os_version(UINT32_MAX),
+      m_system_arch(),
+      m_mutex(),
+      m_uid_map(),
+      m_gid_map(),
+      m_max_uid_name_len(0),
+      m_max_gid_name_len(0),
+      m_supports_rsync(false),
+      m_rsync_opts(),
+      m_rsync_prefix(),
+      m_supports_ssh(false),
+      m_ssh_opts(),
+      m_ignores_remote_hostname(false),
+      m_trap_handlers(),
+      m_calculated_trap_handlers(false),
+      m_module_cache(llvm::make_unique<ModuleCache>())
 {
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
     if (log)
-        log->Printf ("%p Platform::Platform()", static_cast<void*>(this));
+        log->Printf("%p Platform::Platform()", static_cast<void *>(this));
 }
 
 //------------------------------------------------------------------
@@ -528,7 +528,7 @@ Platform::GetOSVersion (uint32_t &major,
                         uint32_t &update,
                         Process *process)
 {
-    Mutex::Locker locker (m_mutex);
+    std::lock_guard<std::mutex> guard(m_mutex);
 
     bool success = m_major_os_version != UINT32_MAX;
     if (IsHost())
@@ -1741,7 +1741,7 @@ Platform::GetTrapHandlerSymbolNames ()
 {
     if (!m_calculated_trap_handlers)
     {
-        Mutex::Locker locker (m_mutex);
+        std::lock_guard<std::mutex> guard(m_mutex);
         if (!m_calculated_trap_handlers)
         {
             CalculateTrapHandlerSymbolNames();

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue May 17 20:59:10 2016
@@ -1795,7 +1795,7 @@ Process::SetPrivateState (StateType new_
         log->Printf("Process::SetPrivateState (%s)", StateAsCString(new_state));
 
     Mutex::Locker thread_locker(m_thread_list.GetMutex());
-    Mutex::Locker locker(m_private_state.GetMutex());
+    std::lock_guard<std::recursive_mutex> guard(m_private_state.GetMutex());
 
     const StateType old_state = m_private_state.GetValueNoLock ();
     state_changed = old_state != new_state;

Modified: lldb/trunk/source/Target/SectionLoadHistory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadHistory.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadHistory.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadHistory.cpp Tue May 17 20:59:10 2016
@@ -23,21 +23,21 @@ using namespace lldb_private;
 bool
 SectionLoadHistory::IsEmpty() const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_stop_id_to_section_load_list.empty();
 }
 
 void
 SectionLoadHistory::Clear ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_stop_id_to_section_load_list.clear();
 }
 
 uint32_t
 SectionLoadHistory::GetLastStopID() const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (m_stop_id_to_section_load_list.empty())
         return 0;
     else
@@ -108,7 +108,7 @@ SectionLoadList &
 SectionLoadHistory::GetCurrentSectionLoadList ()
 {
     const bool read_only = true;
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     SectionLoadList *section_load_list = GetSectionLoadListForStopID (eStopIDNow, read_only);
     assert(section_load_list != NULL);
     return *section_load_list;
@@ -117,7 +117,7 @@ SectionLoadHistory::GetCurrentSectionLoa
 addr_t
 SectionLoadHistory::GetSectionLoadAddress (uint32_t stop_id, const lldb::SectionSP &section_sp)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const bool read_only = true;
     SectionLoadList *section_load_list = GetSectionLoadListForStopID (stop_id, read_only);
     return section_load_list->GetSectionLoadAddress(section_sp);
@@ -127,7 +127,7 @@ bool
 SectionLoadHistory::ResolveLoadAddress (uint32_t stop_id, addr_t load_addr, Address &so_addr)
 {
     // First find the top level section that this load address exists in
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const bool read_only = true;
     SectionLoadList *section_load_list = GetSectionLoadListForStopID (stop_id, read_only);
     return section_load_list->ResolveLoadAddress (load_addr, so_addr);
@@ -139,7 +139,7 @@ SectionLoadHistory::SetSectionLoadAddres
                                            addr_t load_addr,
                                            bool warn_multiple)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const bool read_only = false;
     SectionLoadList *section_load_list = GetSectionLoadListForStopID (stop_id, read_only);
     return section_load_list->SetSectionLoadAddress(section_sp, load_addr, warn_multiple);
@@ -148,7 +148,7 @@ SectionLoadHistory::SetSectionLoadAddres
 size_t
 SectionLoadHistory::SetSectionUnloaded (uint32_t stop_id, const lldb::SectionSP &section_sp)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const bool read_only = false;
     SectionLoadList *section_load_list = GetSectionLoadListForStopID (stop_id, read_only);
     return section_load_list->SetSectionUnloaded (section_sp);
@@ -157,7 +157,7 @@ SectionLoadHistory::SetSectionUnloaded (
 bool
 SectionLoadHistory::SetSectionUnloaded (uint32_t stop_id, const lldb::SectionSP &section_sp, addr_t load_addr)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     const bool read_only = false;
     SectionLoadList *section_load_list = GetSectionLoadListForStopID (stop_id, read_only);
     return section_load_list->SetSectionUnloaded (section_sp, load_addr);
@@ -166,7 +166,7 @@ SectionLoadHistory::SetSectionUnloaded (
 void
 SectionLoadHistory::Dump (Stream &s, Target *target)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     StopIDToSectionLoadList::iterator pos, end = m_stop_id_to_section_load_list.end();
     for (pos = m_stop_id_to_section_load_list.begin(); pos != end; ++pos)
     {

Modified: lldb/trunk/source/Target/SectionLoadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/SectionLoadList.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/SectionLoadList.cpp (original)
+++ lldb/trunk/source/Target/SectionLoadList.cpp Tue May 17 20:59:10 2016
@@ -24,13 +24,9 @@
 using namespace lldb;
 using namespace lldb_private;
 
-
-SectionLoadList::SectionLoadList (const SectionLoadList& rhs) :
-    m_addr_to_sect(),
-    m_sect_to_addr(),
-    m_mutex (Mutex::eMutexTypeRecursive)
+SectionLoadList::SectionLoadList(const SectionLoadList &rhs) : m_addr_to_sect(), m_sect_to_addr(), m_mutex()
 {
-    Mutex::Locker locker(rhs.m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(rhs.m_mutex);
     m_addr_to_sect = rhs.m_addr_to_sect;
     m_sect_to_addr = rhs.m_sect_to_addr;
 }
@@ -38,8 +34,8 @@ SectionLoadList::SectionLoadList (const
 void
 SectionLoadList::operator=(const SectionLoadList &rhs)
 {
-    Mutex::Locker lhs_locker (m_mutex);
-    Mutex::Locker rhs_locker (rhs.m_mutex);
+    std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
+    std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
     m_addr_to_sect = rhs.m_addr_to_sect;
     m_sect_to_addr = rhs.m_sect_to_addr;
 }
@@ -47,14 +43,14 @@ SectionLoadList::operator=(const Section
 bool
 SectionLoadList::IsEmpty() const
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     return m_addr_to_sect.empty();
 }
 
 void
 SectionLoadList::Clear ()
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     m_addr_to_sect.clear();
     m_sect_to_addr.clear();
 }
@@ -66,7 +62,7 @@ SectionLoadList::GetSectionLoadAddress (
     addr_t section_load_addr = LLDB_INVALID_ADDRESS;
     if (section)
     {
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         sect_to_addr_collection::const_iterator pos = m_sect_to_addr.find (section.get());
         
         if (pos != m_sect_to_addr.end())
@@ -98,7 +94,7 @@ SectionLoadList::SetSectionLoadAddress (
             return false; // No change
 
         // Fill in the section -> load_addr map
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
         sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section.get());
         if (sta_pos != m_sect_to_addr.end())
         {
@@ -185,7 +181,7 @@ SectionLoadList::SetSectionUnloaded (con
                          section_sp->GetName().AsCString());
         }
 
-        Mutex::Locker locker(m_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
         sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section_sp.get());
         if (sta_pos != m_sect_to_addr.end())
@@ -222,7 +218,7 @@ SectionLoadList::SetSectionUnloaded (con
                      section_sp->GetName().AsCString(), load_addr);
     }
     bool erased = false;
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section_sp.get());
     if (sta_pos != m_sect_to_addr.end())
     {
@@ -244,8 +240,8 @@ SectionLoadList::SetSectionUnloaded (con
 bool
 SectionLoadList::ResolveLoadAddress (addr_t load_addr, Address &so_addr) const
 {
-    // First find the top level section that this load address exists in    
-    Mutex::Locker locker(m_mutex);
+    // First find the top level section that this load address exists in
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     if (!m_addr_to_sect.empty())
     {
         addr_to_sect_collection::const_iterator pos = m_addr_to_sect.lower_bound (load_addr);
@@ -289,7 +285,7 @@ SectionLoadList::ResolveLoadAddress (add
 void
 SectionLoadList::Dump (Stream &s, Target *target)
 {
-    Mutex::Locker locker(m_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_mutex);
     addr_to_sect_collection::const_iterator pos, end;
     for (pos = m_addr_to_sect.begin(), end = m_addr_to_sect.end(); pos != end; ++pos)
     {

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue May 17 20:59:10 2016
@@ -2611,11 +2611,11 @@ Target::GetSourceManager ()
 ClangModulesDeclVendor *
 Target::GetClangModulesDeclVendor ()
 {
-    static Mutex s_clang_modules_decl_vendor_mutex; // If this is contended we can make it per-target
-    
+    static std::mutex s_clang_modules_decl_vendor_mutex; // If this is contended we can make it per-target
+
     {
-        Mutex::Locker clang_modules_decl_vendor_locker(s_clang_modules_decl_vendor_mutex);
-        
+        std::lock_guard<std::mutex> guard(s_clang_modules_decl_vendor_mutex);
+
         if (!m_clang_modules_decl_vendor_ap)
         {
             m_clang_modules_decl_vendor_ap.reset(ClangModulesDeclVendor::Create(*this));

Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Tue May 17 20:59:10 2016
@@ -42,11 +42,11 @@ TargetList::GetStaticBroadcasterClass ()
 //----------------------------------------------------------------------
 // TargetList constructor
 //----------------------------------------------------------------------
-TargetList::TargetList(Debugger &debugger) :
-    Broadcaster(debugger.GetBroadcasterManager(), TargetList::GetStaticBroadcasterClass().AsCString()),
-    m_target_list(),
-    m_target_list_mutex (Mutex::eMutexTypeRecursive),
-    m_selected_target_idx (0)
+TargetList::TargetList(Debugger &debugger)
+    : Broadcaster(debugger.GetBroadcasterManager(), TargetList::GetStaticBroadcasterClass().AsCString()),
+      m_target_list(),
+      m_target_list_mutex(),
+      m_selected_target_idx(0)
 {
     CheckInWithManager();
 }
@@ -56,7 +56,7 @@ TargetList::TargetList(Debugger &debugge
 //----------------------------------------------------------------------
 TargetList::~TargetList()
 {
-    Mutex::Locker locker(m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     m_target_list.clear();
 }
 
@@ -515,7 +515,7 @@ TargetList::CreateTargetInternal (Debugg
         // Don't put the dummy target in the target list, it's held separately.
         if (!is_dummy_target)
         {
-            Mutex::Locker locker(m_target_list_mutex);
+            std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
             m_selected_target_idx = m_target_list.size();
             m_target_list.push_back(target_sp);
             // Now prime this from the dummy target:
@@ -533,7 +533,7 @@ TargetList::CreateTargetInternal (Debugg
 bool
 TargetList::DeleteTarget (TargetSP &target_sp)
 {
-    Mutex::Locker locker(m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     collection::iterator pos, end = m_target_list.end();
 
     for (pos = m_target_list.begin(); pos != end; ++pos)
@@ -551,7 +551,7 @@ TargetSP
 TargetList::FindTargetWithExecutableAndArchitecture(const FileSpec &exe_file_spec,
                                                     const ArchSpec *exe_arch_ptr) const
 {
-    Mutex::Locker locker (m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     TargetSP target_sp;
     bool full_match = (bool)exe_file_spec.GetDirectory();
 
@@ -580,7 +580,7 @@ TargetList::FindTargetWithExecutableAndA
 TargetSP
 TargetList::FindTargetWithProcessID (lldb::pid_t pid) const
 {
-    Mutex::Locker locker(m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     TargetSP target_sp;
     collection::const_iterator pos, end = m_target_list.end();
     for (pos = m_target_list.begin(); pos != end; ++pos)
@@ -601,7 +601,7 @@ TargetList::FindTargetWithProcess (Proce
     TargetSP target_sp;
     if (process)
     {
-        Mutex::Locker locker(m_target_list_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
         collection::const_iterator pos, end = m_target_list.end();
         for (pos = m_target_list.begin(); pos != end; ++pos)
         {
@@ -621,7 +621,7 @@ TargetList::GetTargetSP (Target *target)
     TargetSP target_sp;
     if (target)
     {
-        Mutex::Locker locker(m_target_list_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
         collection::const_iterator pos, end = m_target_list.end();
         for (pos = m_target_list.begin(); pos != end; ++pos)
         {
@@ -671,7 +671,7 @@ TargetList::SignalIfRunning (lldb::pid_t
     if (pid == LLDB_INVALID_PROCESS_ID)
     {
         // Signal all processes with signal
-        Mutex::Locker locker(m_target_list_mutex);
+        std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
         collection::iterator pos, end = m_target_list.end();
         for (pos = m_target_list.begin(); pos != end; ++pos)
         {
@@ -709,7 +709,7 @@ TargetList::SignalIfRunning (lldb::pid_t
 int
 TargetList::GetNumTargets () const
 {
-    Mutex::Locker locker (m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     return m_target_list.size();
 }
 
@@ -717,7 +717,7 @@ lldb::TargetSP
 TargetList::GetTargetAtIndex (uint32_t idx) const
 {
     TargetSP target_sp;
-    Mutex::Locker locker (m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     if (idx < m_target_list.size())
         target_sp = m_target_list[idx];
     return target_sp;
@@ -726,7 +726,7 @@ TargetList::GetTargetAtIndex (uint32_t i
 uint32_t
 TargetList::GetIndexOfTarget (lldb::TargetSP target_sp) const
 {
-    Mutex::Locker locker (m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     size_t num_targets = m_target_list.size();
     for (size_t idx = 0; idx < num_targets; idx++)
     {
@@ -739,7 +739,7 @@ TargetList::GetIndexOfTarget (lldb::Targ
 uint32_t
 TargetList::SetSelectedTarget (Target* target)
 {
-    Mutex::Locker locker (m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     collection::const_iterator pos,
         begin = m_target_list.begin(),
         end = m_target_list.end();
@@ -758,7 +758,7 @@ TargetList::SetSelectedTarget (Target* t
 lldb::TargetSP
 TargetList::GetSelectedTarget ()
 {
-    Mutex::Locker locker (m_target_list_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
     if (m_selected_target_idx >= m_target_list.size())
         m_selected_target_idx = 0;
     return GetTargetAtIndex (m_selected_target_idx);

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Tue May 17 20:59:10 2016
@@ -9,7 +9,6 @@
 
 // C Includes
 // C++ Includes
-#include <mutex>
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Breakpoint/BreakpointLocation.h"
@@ -271,36 +270,36 @@ Thread::GetStaticBroadcasterClass ()
     return class_name;
 }
 
-Thread::Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id) :
-    ThreadProperties (false),
-    UserID (tid),
-    Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(), Thread::GetStaticBroadcasterClass().AsCString()),
-    m_process_wp (process.shared_from_this()),
-    m_stop_info_sp (),
-    m_stop_info_stop_id (0),
-    m_stop_info_override_stop_id (0),
-    m_index_id (use_invalid_index_id ? LLDB_INVALID_INDEX32 : process.GetNextThreadIndexID(tid)),
-    m_reg_context_sp (),
-    m_state (eStateUnloaded),
-    m_state_mutex (Mutex::eMutexTypeRecursive),
-    m_plan_stack (),
-    m_completed_plan_stack(),
-    m_frame_mutex (Mutex::eMutexTypeRecursive),
-    m_curr_frames_sp (),
-    m_prev_frames_sp (),
-    m_resume_signal (LLDB_INVALID_SIGNAL_NUMBER),
-    m_resume_state (eStateRunning),
-    m_temporary_resume_state (eStateRunning),
-    m_unwinder_ap (),
-    m_destroy_called (false),
-    m_override_should_notify (eLazyBoolCalculate),
-    m_extended_info_fetched (false),
-    m_extended_info ()
+Thread::Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id)
+    : ThreadProperties(false),
+      UserID(tid),
+      Broadcaster(process.GetTarget().GetDebugger().GetBroadcasterManager(),
+                  Thread::GetStaticBroadcasterClass().AsCString()),
+      m_process_wp(process.shared_from_this()),
+      m_stop_info_sp(),
+      m_stop_info_stop_id(0),
+      m_stop_info_override_stop_id(0),
+      m_index_id(use_invalid_index_id ? LLDB_INVALID_INDEX32 : process.GetNextThreadIndexID(tid)),
+      m_reg_context_sp(),
+      m_state(eStateUnloaded),
+      m_state_mutex(),
+      m_plan_stack(),
+      m_completed_plan_stack(),
+      m_frame_mutex(),
+      m_curr_frames_sp(),
+      m_prev_frames_sp(),
+      m_resume_signal(LLDB_INVALID_SIGNAL_NUMBER),
+      m_resume_state(eStateRunning),
+      m_temporary_resume_state(eStateRunning),
+      m_unwinder_ap(),
+      m_destroy_called(false),
+      m_override_should_notify(eLazyBoolCalculate),
+      m_extended_info_fetched(false),
+      m_extended_info()
 {
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
     if (log)
-        log->Printf ("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")",
-                     static_cast<void*>(this), GetID());
+        log->Printf("%p Thread::Thread(tid = 0x%4.4" PRIx64 ")", static_cast<void *>(this), GetID());
 
     CheckInWithManager();
     QueueFundamentalPlan(true);
@@ -345,7 +344,7 @@ Thread::DestroyThread ()
     m_stop_info_sp.reset();
     m_reg_context_sp.reset();
     m_unwinder_ap.reset();
-    Mutex::Locker locker(m_frame_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
     m_curr_frames_sp.reset();
     m_prev_frames_sp.reset();
 }
@@ -645,14 +644,14 @@ StateType
 Thread::GetState() const
 {
     // If any other threads access this we will need a mutex for it
-    Mutex::Locker locker(m_state_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
     return m_state;
 }
 
 void
 Thread::SetState(StateType state)
 {
-    Mutex::Locker locker(m_state_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_state_mutex);
     m_state = state;
 }
 
@@ -1823,7 +1822,7 @@ StackFrameListSP
 Thread::GetStackFrameList ()
 {
     StackFrameListSP frame_list_sp;
-    Mutex::Locker locker(m_frame_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
     if (m_curr_frames_sp)
     {
         frame_list_sp = m_curr_frames_sp;
@@ -1839,7 +1838,7 @@ Thread::GetStackFrameList ()
 void
 Thread::ClearStackFrames ()
 {
-    Mutex::Locker locker(m_frame_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_frame_mutex);
 
     Unwind *unwinder = GetUnwinder ();
     if (unwinder)

Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Tue May 17 20:59:10 2016
@@ -27,21 +27,21 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // ThreadPlan constructor
 //----------------------------------------------------------------------
-ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote stop_vote, Vote run_vote) :
-    m_thread (thread),
-    m_stop_vote (stop_vote),
-    m_run_vote (run_vote),
-    m_kind (kind),
-    m_name (name),
-    m_plan_complete_mutex (Mutex::eMutexTypeRecursive),
-    m_cached_plan_explains_stop (eLazyBoolCalculate),
-    m_plan_complete (false),
-    m_plan_private (false),
-    m_okay_to_discard (true),
-    m_is_master_plan (false),
-    m_plan_succeeded(true)
+ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote stop_vote, Vote run_vote)
+    : m_thread(thread),
+      m_stop_vote(stop_vote),
+      m_run_vote(run_vote),
+      m_kind(kind),
+      m_name(name),
+      m_plan_complete_mutex(),
+      m_cached_plan_explains_stop(eLazyBoolCalculate),
+      m_plan_complete(false),
+      m_plan_private(false),
+      m_okay_to_discard(true),
+      m_is_master_plan(false),
+      m_plan_succeeded(true)
 {
-    SetID (GetNextID());
+    SetID(GetNextID());
 }
 
 //----------------------------------------------------------------------
@@ -67,14 +67,14 @@ ThreadPlan::PlanExplainsStop (Event *eve
 bool
 ThreadPlan::IsPlanComplete ()
 {
-    Mutex::Locker locker(m_plan_complete_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_plan_complete_mutex);
     return m_plan_complete;
 }
 
 void
 ThreadPlan::SetPlanComplete (bool success)
 {
-    Mutex::Locker locker(m_plan_complete_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_plan_complete_mutex);
     m_plan_complete = true;
     m_plan_succeeded = success;
 }
@@ -82,7 +82,7 @@ ThreadPlan::SetPlanComplete (bool succes
 bool
 ThreadPlan::MischiefManaged ()
 {
-    Mutex::Locker locker(m_plan_complete_mutex);
+    std::lock_guard<std::recursive_mutex> guard(m_plan_complete_mutex);
     // Mark the plan is complete, but don't override the success flag.
     m_plan_complete = true;
     return true;

Modified: lldb/trunk/source/Utility/SharingPtr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SharingPtr.cpp?rev=269877&r1=269876&r2=269877&view=diff
==============================================================================
--- lldb/trunk/source/Utility/SharingPtr.cpp (original)
+++ lldb/trunk/source/Utility/SharingPtr.cpp Tue May 17 20:59:10 2016
@@ -14,12 +14,12 @@
 // If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments
 // and allow them to be queried using a pointer by a call to:
 #include <execinfo.h>
-#include <map>
 #include <assert.h>
-#include "lldb/Host/Mutex.h"
 
 #include "llvm/ADT/STLExtras.h"
 
+#include <map>
+#include <mutex>
 #include <vector>
 
 class Backtrace
@@ -70,8 +70,8 @@ extern "C" void track_sp (void *sp_this,
 {
     typedef std::pair<void *, Backtrace> PtrBacktracePair;
     typedef std::map<void *, PtrBacktracePair> PtrToBacktraceMap;
-    static lldb_private::Mutex g_mutex(lldb_private::Mutex::eMutexTypeNormal);
-    lldb_private::Mutex::Locker locker (g_mutex);
+    static std::mutex g_mutex;
+    std::lock_guard<std::mutex> guard(g_mutex);
     static PtrToBacktraceMap g_map;
 
     if (sp_this)




More information about the lldb-commits mailing list