remove use of Mutex in favour of std::{,recursive_}mutex

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

llvm-svn: 269877
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
index c262ffc..d311f5f 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -100,12 +100,12 @@
 }                                                                                                               \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 @@
 }
 
 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 @@
 
     // 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 @@
     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);