<div dir="ltr">Hi Saleem,<div><br></div><div>It looks like you're missing Condition.cpp from your checkin @277011?  Can you add it?</div><div><br></div><div>-Todd</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 10:32 AM, Saleem Abdulrasool via lldb-commits <span dir="ltr"><<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: compnerd<br>
Date: Thu Jul 28 12:32:20 2016<br>
New Revision: 277011<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=277011&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=277011&view=rev</a><br>
Log:<br>
Clean up vestigial remnants of locking primitives<br>
<br>
This finally removes the use of the Mutex and Condition classes. This is an<br>
intricate patch as the Mutex and Condition classes were tied together.<br>
Furthermore, many places had slightly differing uses of time values. Convert<br>
timeout values to relative everywhere to permit the use of<br>
std::chrono::duration, which is required for the use of<br>
std::condition_variable's timeout. Adjust all Condition and related Mutex<br>
classes over to std::{,recursive_}mutex and std::condition_variable.<br>
<br>
This change primarily comes at the cost of breaking the TracingMutex which was<br>
based around the Mutex class. It would be possible to write a wrapper to<br>
provide similar functionality, but that is beyond the scope of this change.<br>
<br>
Removed:<br>
    lldb/trunk/include/lldb/Host/Condition.h<br>
    lldb/trunk/include/lldb/Host/Mutex.h<br>
    lldb/trunk/source/Host/common/Condition.cpp<br>
    lldb/trunk/source/Host/common/Mutex.cpp<br>
    lldb/trunk/source/Host/windows/Condition.cpp<br>
    lldb/trunk/source/Host/windows/Mutex.cpp<br>
Modified:<br>
    lldb/trunk/include/lldb/Core/Event.h<br>
    lldb/trunk/include/lldb/Core/Listener.h<br>
    lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h<br>
    lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h<br>
    lldb/trunk/include/lldb/Host/Editline.h<br>
    lldb/trunk/include/lldb/Host/Predicate.h<br>
    lldb/trunk/include/lldb/Host/ProcessRunLock.h<br>
    lldb/trunk/include/lldb/Target/Process.h<br>
    lldb/trunk/source/API/SBListener.cpp<br>
    lldb/trunk/source/Core/Communication.cpp<br>
    lldb/trunk/source/Core/Debugger.cpp<br>
    lldb/trunk/source/Core/Listener.cpp<br>
    lldb/trunk/source/Host/CMakeLists.txt<br>
    lldb/trunk/source/Host/common/Host.cpp<br>
    lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp<br>
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h<br>
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp<br>
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp<br>
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h<br>
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp<br>
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp<br>
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h<br>
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br>
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h<br>
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp<br>
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br>
    lldb/trunk/source/Target/Process.cpp<br>
    lldb/trunk/source/Target/Target.cpp<br>
<br>
Modified: lldb/trunk/include/lldb/Core/Event.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Event.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Event.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Core/Event.h (original)<br>
+++ lldb/trunk/include/lldb/Core/Event.h Thu Jul 28 12:32:20 2016<br>
@@ -12,6 +12,7 @@<br>
<br>
 // C Includes<br>
 // C++ Includes<br>
+#include <chrono><br>
 #include <memory><br>
 #include <string><br>
<br>
@@ -141,7 +142,8 @@ public:<br>
     }<br>
<br>
     bool<br>
-    WaitForEventReceived (const TimeValue *abstime = nullptr, bool *timed_out = nullptr)<br>
+    WaitForEventReceived(const std::chrono::microseconds &abstime = std::chrono::microseconds(0),<br>
+                         bool *timed_out = nullptr)<br>
     {<br>
         return m_predicate.WaitForValueEqualTo(true, abstime, timed_out);<br>
     }<br>
<br>
Modified: lldb/trunk/include/lldb/Core/Listener.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Listener.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Listener.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Core/Listener.h (original)<br>
+++ lldb/trunk/include/lldb/Core/Listener.h Thu Jul 28 12:32:20 2016<br>
@@ -12,6 +12,7 @@<br>
<br>
 // C Includes<br>
 // C++ Includes<br>
+#include <chrono><br>
 #include <list><br>
 #include <map><br>
 #include <mutex><br>
@@ -21,8 +22,6 @@<br>
 // Other libraries and framework includes<br>
 // Project includes<br>
 #include "lldb/lldb-private.h"<br>
-#include "lldb/Core/Broadcaster.h"<br>
-#include "lldb/Host/Condition.h"<br>
 #include "lldb/Core/Event.h"<br>
<br>
 namespace lldb_private {<br>
@@ -87,19 +86,15 @@ public:<br>
<br>
     // Returns true if an event was received, false if we timed out.<br>
     bool<br>
-    WaitForEvent (const TimeValue *timeout,<br>
-                  lldb::EventSP &event_sp);<br>
+    WaitForEvent(const std::chrono::microseconds &timeout, lldb::EventSP &event_sp);<br>
<br>
     bool<br>
-    WaitForEventForBroadcaster (const TimeValue *timeout,<br>
-                                Broadcaster *broadcaster,<br>
-                                lldb::EventSP &event_sp);<br>
+    WaitForEventForBroadcaster(const std::chrono::microseconds &timeout, Broadcaster *broadcaster,<br>
+                               lldb::EventSP &event_sp);<br>
<br>
     bool<br>
-    WaitForEventForBroadcasterWithType (const TimeValue *timeout,<br>
-                                        Broadcaster *broadcaster,<br>
-                                        uint32_t event_type_mask,<br>
-                                        lldb::EventSP &event_sp);<br>
+    WaitForEventForBroadcasterWithType(const std::chrono::microseconds &timeout, Broadcaster *broadcaster,<br>
+                                       uint32_t event_type_mask, lldb::EventSP &event_sp);<br>
<br>
     Event *<br>
     PeekAtNextEvent ();<br>
@@ -151,13 +146,10 @@ private:<br>
     typedef std::vector<lldb::BroadcasterManagerWP> broadcaster_manager_collection;<br>
<br>
     bool<br>
-    FindNextEventInternal(Mutex::Locker& lock,<br>
+    FindNextEventInternal(std::unique_lock<std::mutex> &lock,<br>
                           Broadcaster *broadcaster,   // nullptr for any broadcaster<br>
                           const ConstString *sources, // nullptr for any event<br>
-                          uint32_t num_sources,<br>
-                          uint32_t event_type_mask,<br>
-                          lldb::EventSP &event_sp,<br>
-                          bool remove);<br>
+                          uint32_t num_sources, uint32_t event_type_mask, lldb::EventSP &event_sp, bool remove);<br>
<br>
     bool<br>
     GetNextEventInternal(Broadcaster *broadcaster,   // nullptr for any broadcaster<br>
@@ -167,19 +159,17 @@ private:<br>
                          lldb::EventSP &event_sp);<br>
<br>
     bool<br>
-    WaitForEventsInternal(const TimeValue *timeout,<br>
+    WaitForEventsInternal(const std::chrono::microseconds &timeout,<br>
                           Broadcaster *broadcaster,   // nullptr for any broadcaster<br>
                           const ConstString *sources, // nullptr for any event<br>
-                          uint32_t num_sources,<br>
-                          uint32_t event_type_mask,<br>
-                          lldb::EventSP &event_sp);<br>
+                          uint32_t num_sources, uint32_t event_type_mask, lldb::EventSP &event_sp);<br>
<br>
     std::string m_name;<br>
     broadcaster_collection m_broadcasters;<br>
     std::recursive_mutex m_broadcasters_mutex; // Protects m_broadcasters<br>
     event_collection m_events;<br>
-    Mutex m_events_mutex; // Protects m_broadcasters and m_events<br>
-    Condition m_events_condition;<br>
+    std::mutex m_events_mutex; // Protects m_broadcasters and m_events<br>
+    std::condition_variable m_events_condition;<br>
     broadcaster_manager_collection m_broadcaster_managers;<br>
<br>
     void<br>
<br>
Modified: lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h (original)<br>
+++ lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h Thu Jul 28 12:32:20 2016<br>
@@ -12,46 +12,41 @@<br>
<br>
 // C Includes<br>
 // C++ Includes<br>
+#include <mutex><br>
<br>
 // Other libraries and framework includes<br>
 #include "llvm/ADT/DenseMap.h"<br>
<br>
 // Project includes<br>
-#include "lldb/Host/Mutex.h"<br>
<br>
 namespace lldb_private {<br>
<br>
-template <typename _KeyType, typename _ValueType><br>
+template <typename _KeyType, typename _ValueType, typename _MutexType = std::mutex><br>
 class ThreadSafeDenseMap<br>
 {<br>
 public:<br>
     typedef llvm::DenseMap<_KeyType,_ValueType> LLVMMapType;<br>
-<br>
-    ThreadSafeDenseMap(unsigned map_initial_capacity = 0,<br>
-                       Mutex::Type mutex_type = Mutex::eMutexTypeNormal) :<br>
-        m_map(map_initial_capacity),<br>
-        m_mutex(mutex_type)<br>
-    {<br>
-    }<br>
-<br>
+<br>
+    ThreadSafeDenseMap(unsigned map_initial_capacity = 0) : m_map(map_initial_capacity), m_mutex() {}<br>
+<br>
     void<br>
     Insert (_KeyType k, _ValueType v)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
         m_map.insert(std::make_pair(k,v));<br>
     }<br>
<br>
     void<br>
     Erase (_KeyType k)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
         m_map.erase(k);<br>
     }<br>
<br>
     _ValueType<br>
     Lookup (_KeyType k)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
         return m_map.lookup(k);<br>
     }<br>
<br>
@@ -59,7 +54,7 @@ public:<br>
     Lookup (_KeyType k,<br>
             _ValueType& v)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
         auto iter = m_map.find(k),<br>
              end = m_map.end();<br>
         if (iter == end)<br>
@@ -71,13 +66,13 @@ public:<br>
     void<br>
     Clear ()<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
         m_map.clear();<br>
     }<br>
<br>
 protected:<br>
     LLVMMapType m_map;<br>
-    Mutex m_mutex;<br>
+    _MutexType m_mutex;<br>
 };<br>
<br>
 } // namespace lldb_private<br>
<br>
Modified: lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h (original)<br>
+++ lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h Thu Jul 28 12:32:20 2016<br>
@@ -12,61 +12,56 @@<br>
<br>
 // C Includes<br>
 // C++ Includes<br>
+#include <mutex><br>
<br>
 // Other libraries and framework includes<br>
 #include "llvm/ADT/DenseSet.h"<br>
<br>
 // Project includes<br>
-#include "lldb/Host/Mutex.h"<br>
<br>
 namespace lldb_private {<br>
-<br>
-    template <typename _ElementType><br>
-    class ThreadSafeDenseSet<br>
+<br>
+template <typename _ElementType, typename _MutexType = std::mutex><br>
+class ThreadSafeDenseSet<br>
+{<br>
+public:<br>
+    typedef llvm::DenseSet<_ElementType> LLVMSetType;<br>
+<br>
+    ThreadSafeDenseSet(unsigned set_initial_capacity = 0) : m_set(set_initial_capacity), m_mutex() {}<br>
+<br>
+    void<br>
+    Insert(_ElementType e)<br>
     {<br>
-    public:<br>
-        typedef llvm::DenseSet<_ElementType> LLVMSetType;<br>
-<br>
-        ThreadSafeDenseSet(unsigned set_initial_capacity = 0,<br>
-                           Mutex::Type mutex_type = Mutex::eMutexTypeNormal) :<br>
-        m_set(set_initial_capacity),<br>
-        m_mutex(mutex_type)<br>
-        {<br>
-        }<br>
-<br>
-        void<br>
-        Insert (_ElementType e)<br>
-        {<br>
-            Mutex::Locker locker(m_mutex);<br>
-            m_set.insert(e);<br>
-        }<br>
-<br>
-        void<br>
-        Erase (_ElementType e)<br>
-        {<br>
-            Mutex::Locker locker(m_mutex);<br>
-            m_set.erase(e);<br>
-        }<br>
-<br>
-        bool<br>
-        Lookup (_ElementType e)<br>
-        {<br>
-            Mutex::Locker locker(m_mutex);<br>
-            return (m_set.count(e) > 0);<br>
-        }<br>
-<br>
-        void<br>
-        Clear ()<br>
-        {<br>
-            Mutex::Locker locker(m_mutex);<br>
-            m_set.clear();<br>
-        }<br>
-<br>
-    protected:<br>
-        LLVMSetType m_set;<br>
-        Mutex m_mutex;<br>
-    };<br>
-<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
+        m_set.insert(e);<br>
+    }<br>
+<br>
+    void<br>
+    Erase(_ElementType e)<br>
+    {<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
+        m_set.erase(e);<br>
+    }<br>
+<br>
+    bool<br>
+    Lookup(_ElementType e)<br>
+    {<br>
+        std::lock_guard<_MutexType> guard(m_mutex);<br>
+        return (m_set.count(e) > 0);<br>
+    }<br>
+<br>
+    void<br>
+    Clear()<br>
+    {<br>
+        stds::lock_guard<_MutexType> guard(m_mutex);<br>
+        m_set.clear();<br>
+    }<br>
+<br>
+protected:<br>
+    LLVMSetType m_set;<br>
+    _MutexType m_mutex;<br>
+};<br>
+<br>
 } // namespace lldb_private<br>
<br>
 #endif  // liblldb_ThreadSafeDenseSet_h_<br>
<br>
Removed: lldb/trunk/include/lldb/Host/Condition.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Condition.h?rev=277010&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Condition.h?rev=277010&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Host/Condition.h (original)<br>
+++ lldb/trunk/include/lldb/Host/Condition.h (removed)<br>
@@ -1,123 +0,0 @@<br>
-//===-- Condition.h ---------------------------------------------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef liblldb_Condition_h_<br>
-#define liblldb_Condition_h_<br>
-<br>
-// C Includes<br>
-// C++ Includes<br>
-// Other libraries and framework includes<br>
-// Project includes<br>
-#include "lldb/lldb-types.h"<br>
-#include "lldb/Host/Mutex.h"<br>
-<br>
-namespace lldb_private {<br>
-<br>
-class TimeValue;<br>
-<br>
-//----------------------------------------------------------------------<br>
-/// @class Condition Condition.h "lldb/Host/Condition.h"<br>
-/// @brief A C++ wrapper class for pthread condition variables.<br>
-///<br>
-/// A class that wraps up a pthread condition (pthread_cond_t). The<br>
-/// class will create a pthread condition when an instance is<br>
-/// constructed, and destroy it when it is destructed. It also provides<br>
-/// access to the standard pthread condition calls.<br>
-//----------------------------------------------------------------------<br>
-class Condition<br>
-{<br>
-public:<br>
-    //------------------------------------------------------------------<br>
-    /// Default constructor<br>
-    ///<br>
-    /// The default constructor will initialize a new pthread condition<br>
-    /// and maintain the condition in the object state.<br>
-    //------------------------------------------------------------------<br>
-    Condition ();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Destructor<br>
-    ///<br>
-    /// Destroys the pthread condition that the object owns.<br>
-    //------------------------------------------------------------------<br>
-    ~Condition ();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Unblock all threads waiting for a condition variable<br>
-    ///<br>
-    /// @return<br>
-    ///     The return value from \c pthread_cond_broadcast()<br>
-    //------------------------------------------------------------------<br>
-    int<br>
-    Broadcast ();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Unblocks one thread waiting for the condition variable<br>
-    ///<br>
-    /// @return<br>
-    ///     The return value from \c pthread_cond_signal()<br>
-    //------------------------------------------------------------------<br>
-    int<br>
-    Signal ();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Wait for the condition variable to be signaled.<br>
-    ///<br>
-    /// The Wait() function atomically blocks the current thread<br>
-    /// waiting on this object's condition variable, and unblocks<br>
-    /// \a mutex. The waiting thread unblocks only after another thread<br>
-    /// signals or broadcasts this object's condition variable.<br>
-    ///<br>
-    /// If \a abstime is non-nullptr, this function will return when the<br>
-    /// system time reaches the time specified in \a abstime if the<br>
-    /// condition variable doesn't get unblocked. If \a abstime is nullptr<br>
-    /// this function will wait for an infinite amount of time for the<br>
-    /// condition variable to be unblocked.<br>
-    ///<br>
-    /// The current thread re-acquires the lock on \a mutex following<br>
-    /// the wait.<br>
-    ///<br>
-    /// @param[in] mutex<br>
-    ///     The mutex to use in the \c pthread_cond_timedwait() or<br>
-    ///     \c pthread_cond_wait() calls.<br>
-    ///<br>
-    /// @param[in] abstime<br>
-    ///     An absolute time at which to stop waiting if non-nullptr, else<br>
-    ///     wait an infinite amount of time for the condition variable<br>
-    ///     toget signaled.<br>
-    ///<br>
-    /// @param[out] timed_out<br>
-    ///     If not nullptr, will be set to true if the wait timed out, and<br>
-    //      false otherwise.<br>
-    ///<br>
-    /// @see Condition::Broadcast()<br>
-    /// @see Condition::Signal()<br>
-    //------------------------------------------------------------------<br>
-    int<br>
-    Wait(Mutex &mutex, const TimeValue *abstime = nullptr, bool *timed_out = nullptr);<br>
-<br>
-protected:<br>
-    //------------------------------------------------------------------<br>
-    // Member variables<br>
-    //------------------------------------------------------------------<br>
-    lldb::condition_t m_condition; ///< The condition variable.<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Get accessor to the pthread condition object.<br>
-    ///<br>
-    /// @return<br>
-    ///     A pointer to the condition variable owned by this object.<br>
-    //------------------------------------------------------------------<br>
-    lldb::condition_t *<br>
-    GetCondition ();<br>
-};<br>
-<br>
-} // namespace lldb_private<br>
-<br>
-#endif // liblldb_Condition_h_<br>
<br>
Modified: lldb/trunk/include/lldb/Host/Editline.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Host/Editline.h (original)<br>
+++ lldb/trunk/include/lldb/Host/Editline.h Thu Jul 28 12:32:20 2016<br>
@@ -54,7 +54,6 @@<br>
 #include <string><br>
 #include <vector><br>
<br>
-#include "lldb/Host/Condition.h"<br>
 #include "lldb/Host/ConnectionFileDescriptor.h"<br>
 #include "lldb/Host/FileSpec.h"<br>
 #include "lldb/Host/Predicate.h"<br>
<br>
Removed: lldb/trunk/include/lldb/Host/Mutex.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Mutex.h?rev=277010&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Mutex.h?rev=277010&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Host/Mutex.h (original)<br>
+++ lldb/trunk/include/lldb/Host/Mutex.h (removed)<br>
@@ -1,313 +0,0 @@<br>
-//===-- Mutex.h -------------------------------------------------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef liblldb_Mutex_h_<br>
-#define liblldb_Mutex_h_<br>
-<br>
-// C Includes<br>
-// C++ Includes<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-#include <string><br>
-#endif<br>
-<br>
-// Other libraries and framework includes<br>
-// Project includes<br>
-#include "lldb/lldb-types.h"<br>
-<br>
-namespace lldb_private {<br>
-<br>
-//----------------------------------------------------------------------<br>
-/// @class Mutex Mutex.h "lldb/Host/Mutex.h"<br>
-/// @brief A C++ wrapper class for pthread mutexes.<br>
-//----------------------------------------------------------------------<br>
-class Mutex<br>
-{<br>
-public:<br>
-    friend class Locker;<br>
-    friend class Condition;<br>
-<br>
-    enum Type<br>
-    {<br>
-        eMutexTypeNormal,       ///< Mutex that can't recursively entered by the same thread<br>
-        eMutexTypeRecursive     ///< Mutex can be recursively entered by the same thread<br>
-    };<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// @class Mutex::Locker<br>
-    ///<br>
-    /// A scoped locking class that allows a variety of pthread mutex<br>
-    /// objects to have a mutex locked when an Mutex::Locker<br>
-    /// object is created, and unlocked when it goes out of scope or<br>
-    /// when the Mutex::Locker::Reset(pthread_mutex_t *)<br>
-    /// is called. This provides an exception safe way to lock a mutex<br>
-    /// in a scope.<br>
-    //------------------------------------------------------------------<br>
-    class Locker<br>
-    {<br>
-    public:<br>
-        //--------------------------------------------------------------<br>
-        /// Default constructor.<br>
-        ///<br>
-        /// This will create a scoped mutex locking object that doesn't<br>
-        /// have a mutex to lock. One will need to be provided using the<br>
-        /// Mutex::Locker::Reset(pthread_mutex_t *) method.<br>
-        ///<br>
-        /// @see Mutex::Locker::Reset(pthread_mutex_t *)<br>
-        //--------------------------------------------------------------<br>
-        Locker();<br>
-<br>
-        //--------------------------------------------------------------<br>
-        /// Constructor with a Mutex object.<br>
-        ///<br>
-        /// This will create a scoped mutex locking object that extracts<br>
-        /// the mutex owned by \a m and locks it.<br>
-        ///<br>
-        /// @param[in] m<br>
-        ///     An instance of a Mutex object that contains a<br>
-        ///     valid mutex object.<br>
-        //--------------------------------------------------------------<br>
-        Locker(Mutex& m);<br>
-<br>
-        //--------------------------------------------------------------<br>
-        /// Constructor with a Mutex object pointer.<br>
-        ///<br>
-        /// This will create a scoped mutex locking object that extracts<br>
-        /// the mutex owned by a m and locks it.<br>
-        ///<br>
-        /// @param[in] m<br>
-        ///     A pointer to instance of a Mutex object that<br>
-        ///     contains a valid mutex object.<br>
-        //--------------------------------------------------------------<br>
-        Locker(Mutex* m);<br>
-<br>
-        //--------------------------------------------------------------<br>
-        /// Destructor<br>
-        ///<br>
-        /// Unlocks any valid pthread_mutex_t that this object may<br>
-        /// contain.<br>
-        //--------------------------------------------------------------<br>
-        ~Locker();<br>
-<br>
-        //--------------------------------------------------------------<br>
-        /// Change the contained mutex.<br>
-        ///<br>
-        /// Unlock the current mutex in this object (if it contains a<br>
-        /// valid mutex) and lock the new \a mutex object if it is<br>
-        /// non-nullptr.<br>
-        //--------------------------------------------------------------<br>
-        void<br>
-        Lock (Mutex &mutex);<br>
-<br>
-        void<br>
-        Lock (Mutex *mutex)<br>
-        {<br>
-            if (mutex)<br>
-                Lock(*mutex);<br>
-        }<br>
-<br>
-        //--------------------------------------------------------------<br>
-        /// Change the contained mutex only if the mutex can be locked.<br>
-        ///<br>
-        /// Unlock the current mutex in this object (if it contains a<br>
-        /// valid mutex) and try to lock \a mutex. If \a mutex can be<br>
-        /// locked this object will take ownership of the lock and will<br>
-        /// unlock it when it goes out of scope or Reset or TryLock are<br>
-        /// called again. If the mutex is already locked, this object<br>
-        /// will not take ownership of the mutex.<br>
-        ///<br>
-        /// @return<br>
-        ///     Returns \b true if the lock was acquired and the this<br>
-        ///     object will unlock the mutex when it goes out of scope,<br>
-        ///     returns \b false otherwise.<br>
-        //--------------------------------------------------------------<br>
-        bool<br>
-        TryLock(Mutex &mutex, const char *failure_message = nullptr);<br>
-<br>
-        bool<br>
-        TryLock(Mutex *mutex, const char *failure_message = nullptr)<br>
-        {<br>
-            if (mutex)<br>
-                return TryLock(*mutex, failure_message);<br>
-            else<br>
-                return false;<br>
-        }<br>
-<br>
-        void<br>
-        Unlock ();<br>
-<br>
-    protected:<br>
-        //--------------------------------------------------------------<br>
-        /// Member variables<br>
-        //--------------------------------------------------------------<br>
-        Mutex *m_mutex_ptr;<br>
-<br>
-    private:<br>
-        Locker(const Locker&);<br>
-        const Locker& operator=(const Locker&);<br>
-    };<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Default constructor.<br>
-    ///<br>
-    /// Creates a pthread mutex with no attributes.<br>
-    //------------------------------------------------------------------<br>
-    Mutex();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Default constructor.<br>
-    ///<br>
-    /// Creates a pthread mutex with \a type as the mutex type.<br>
-    /// Valid values for \a type include:<br>
-    ///     @li Mutex::Type::eMutexTypeNormal<br>
-    ///     @li Mutex::Type::eMutexTypeRecursive<br>
-    ///<br>
-    /// @param[in] type<br>
-    ///     The type of the mutex.<br>
-    ///<br>
-    /// @see ::pthread_mutexattr_settype()<br>
-    //------------------------------------------------------------------<br>
-    Mutex(Mutex::Type type);<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Destructor.<br>
-    ///<br>
-    /// Destroys the mutex owned by this object.<br>
-    //------------------------------------------------------------------<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-    virtual<br>
-#endif<br>
-    ~Mutex();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Lock the mutex.<br>
-    ///<br>
-    /// Locks the mutex owned by this object. If the mutex is already<br>
-    /// locked, the calling thread will block until the mutex becomes<br>
-    /// available.<br>
-    ///<br>
-    /// @return<br>
-    ///     The error code from \c pthread_mutex_lock().<br>
-    //------------------------------------------------------------------<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-    virtual<br>
-#endif<br>
-    int<br>
-    Lock();<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Try to lock the mutex.<br>
-    ///<br>
-    /// Attempts to lock the mutex owned by this object without blocking.<br>
-    /// If the mutex is already locked, TryLock() will not block waiting<br>
-    /// for the mutex, but will return an error condition.<br>
-    ///<br>
-    /// @return<br>
-    ///     The error code from \c pthread_mutex_trylock().<br>
-    //------------------------------------------------------------------<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-    virtual<br>
-#endif<br>
-    int<br>
-    TryLock(const char *failure_message = nullptr);<br>
-<br>
-    //------------------------------------------------------------------<br>
-    /// Unlock the mutex.<br>
-    ///<br>
-    /// If the current thread holds the lock on the owned mutex, then<br>
-    /// Unlock() will unlock the mutex. Calling Unlock() on this object<br>
-    /// when the calling thread does not hold the lock will result in<br>
-    /// undefined behavior.<br>
-    ///<br>
-    /// @return<br>
-    ///     The error code from \c pthread_mutex_unlock().<br>
-    //------------------------------------------------------------------<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-    virtual<br>
-#endif<br>
-    int<br>
-    Unlock();<br>
-<br>
-protected:<br>
-    //------------------------------------------------------------------<br>
-    // Member variables<br>
-    //------------------------------------------------------------------<br>
-    // TODO: Hide the mutex in the implementation file in case we ever need to port to an<br>
-    // architecture that doesn't have pthread mutexes.<br>
-    lldb::mutex_t m_mutex; ///< The OS mutex object.<br>
-<br>
-private:<br>
-    //------------------------------------------------------------------<br>
-    /// Mutex get accessor.<br>
-    ///<br>
-    /// @return<br>
-    ///     A pointer to the pthread mutex object owned by this object.<br>
-    //------------------------------------------------------------------<br>
-    lldb::mutex_t *<br>
-    GetMutex();<br>
-<br>
-    Mutex(const Mutex&);<br>
-    const Mutex& operator=(const Mutex&);<br>
-};<br>
-<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-class TrackingMutex : public Mutex<br>
-{<br>
-public:<br>
-    TrackingMutex() : Mutex()  {}<br>
-    TrackingMutex(Mutex::Type type) : Mutex (type) {}<br>
-<br>
-    virtual<br>
-    ~TrackingMutex() = default;<br>
-<br>
-    virtual int<br>
-    Unlock ();<br>
-<br>
-    virtual int<br>
-    TryLock(const char *failure_message = nullptr)<br>
-    {<br>
-        int return_value = Mutex::TryLock();<br>
-        if (return_value != 0 && failure_message != nullptr)<br>
-        {<br>
-            m_failure_message.assign(failure_message);<br>
-            m_thread_that_tried = pthread_self();<br>
-        }<br>
-        return return_value;<br>
-    }<br>
-<br>
-protected:<br>
-    pthread_t m_thread_that_tried;<br>
-    std::string m_failure_message;<br>
-};<br>
-<br>
-class LoggingMutex : public Mutex<br>
-{<br>
-public:<br>
-    LoggingMutex() : Mutex(),m_locked(false)  {}<br>
-    LoggingMutex(Mutex::Type type) : Mutex (type),m_locked(false) {}<br>
-<br>
-    virtual<br>
-    ~LoggingMutex() = default;<br>
-<br>
-    virtual int<br>
-    Lock ();<br>
-<br>
-    virtual int<br>
-    Unlock ();<br>
-<br>
-    virtual int<br>
-    TryLock(const char *failure_message = nullptr);<br>
-<br>
-protected:<br>
-    bool m_locked;<br>
-};<br>
-#endif // LLDB_CONFIGURATION_DEBUG<br>
-<br>
-} // namespace lldb_private<br>
-<br>
-#endif // liblldb_Mutex_h_<br>
<br>
Modified: lldb/trunk/include/lldb/Host/Predicate.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Host/Predicate.h (original)<br>
+++ lldb/trunk/include/lldb/Host/Predicate.h Thu Jul 28 12:32:20 2016<br>
@@ -15,11 +15,12 @@<br>
 #include <time.h><br>
<br>
 // C++ Includes<br>
+#include <condition_variable><br>
+#include <mutex><br>
+<br>
 // Other libraries and framework includes<br>
 // Project includes<br>
 #include "lldb/lldb-defines.h"<br>
-#include "lldb/Host/Mutex.h"<br>
-#include "lldb/Host/Condition.h"<br>
<br>
 //#define DB_PTHREAD_LOG_EVENTS<br>
<br>
@@ -97,7 +98,7 @@ public:<br>
     T<br>
     GetValue () const<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<std::mutex> guard(m_mutex);<br>
         T value = m_value;<br>
         return value;<br>
     }<br>
@@ -120,7 +121,7 @@ public:<br>
     void<br>
     SetValue (T value, PredicateBroadcastType broadcast_type)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<std::mutex> guard(m_mutex);<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
         printf("%s (value = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, value, broadcast_type);<br>
 #endif<br>
@@ -148,7 +149,7 @@ public:<br>
     void<br>
     SetValueBits (T bits, PredicateBroadcastType broadcast_type)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<std::mutex> guard(m_mutex);<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
         printf("%s (bits = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, bits, broadcast_type);<br>
 #endif<br>
@@ -176,7 +177,7 @@ public:<br>
     void<br>
     ResetValueBits (T bits, PredicateBroadcastType broadcast_type)<br>
     {<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::lock_guard<std::mutex> guard(m_mutex);<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
         printf("%s (bits = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, bits, broadcast_type);<br>
 #endif<br>
@@ -213,21 +214,30 @@ public:<br>
     ///     occurred.<br>
     //------------------------------------------------------------------<br>
     T<br>
-    WaitForSetValueBits(T bits, const TimeValue *abstime = nullptr)<br>
+    WaitForSetValueBits(T bits, const std::chrono::microseconds &timeout = std::chrono::microseconds(0))<br>
     {<br>
-        int err = 0;<br>
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically<br>
         // unlock the mutex and wait for the condition to be set. When either<br>
         // function returns, they will re-lock the mutex. We use an auto lock/unlock<br>
-        // class (Mutex::Locker) to allow us to return at any point in this<br>
+        // class (std::lock_guard) to allow us to return at any point in this<br>
         // function and not have to worry about unlocking the mutex.<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::unique_lock<std::mutex> lock(m_mutex);<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
-        printf("%s (bits = 0x%8.8x, abstime = %p), m_value = 0x%8.8x\n", __FUNCTION__, bits, abstime, m_value);<br>
+        printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, bits, timeout.count(),<br>
+               m_value);<br>
 #endif<br>
-        while (err == 0 && ((m_value & bits) == 0))<br>
+        while ((m_value & bits) == 0)<br>
         {<br>
-            err = m_condition.Wait (m_mutex, abstime);<br>
+            if (timeout == std::chrono::microseconds(0))<br>
+            {<br>
+                m_condition.wait(lock);<br>
+            }<br>
+            else<br>
+            {<br>
+                std::cv_status result = m_condition.wait_for(lock, timeout);<br>
+                if (result == std::cv_status::timeout)<br>
+                    break;<br>
+            }<br>
         }<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
         printf("%s (bits = 0x%8.8x), m_value = 0x%8.8x, returning 0x%8.8x\n", __FUNCTION__, bits, m_value, m_value & bits);<br>
@@ -262,23 +272,31 @@ public:<br>
     ///     unrecoverable error occurs.<br>
     //------------------------------------------------------------------<br>
     T<br>
-    WaitForResetValueBits(T bits, const TimeValue *abstime = nullptr)<br>
+    WaitForResetValueBits(T bits, const std::chrono::microseconds &timeout = std::chrono::microseconds(0))<br>
     {<br>
-        int err = 0;<br>
-<br>
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically<br>
         // unlock the mutex and wait for the condition to be set. When either<br>
         // function returns, they will re-lock the mutex. We use an auto lock/unlock<br>
-        // class (Mutex::Locker) to allow us to return at any point in this<br>
+        // class (std::lock_guard) to allow us to return at any point in this<br>
         // function and not have to worry about unlocking the mutex.<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::unique_lock<std::mutex> lock(m_mutex);<br>
<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
-        printf("%s (bits = 0x%8.8x, abstime = %p), m_value = 0x%8.8x\n", __FUNCTION__, bits, abstime, m_value);<br>
+        printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, bits, timeout.count(),<br>
+               m_value);<br>
 #endif<br>
-        while (err == 0 && ((m_value & bits) != 0))<br>
+        while ((m_value & bits) != 0)<br>
         {<br>
-            err = m_condition.Wait (m_mutex, abstime);<br>
+            if (timeout == std::chrono::microseconds(0))<br>
+            {<br>
+                m_condition.wait(lock);<br>
+            }<br>
+            else<br>
+            {<br>
+                std::cv_status result = m_condition.wait_for(lock, timeout);<br>
+                if (result == std::cv_status::timeout)<br>
+                    break;<br>
+            }<br>
         }<br>
<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
@@ -317,25 +335,39 @@ public:<br>
     ///     @li \b false otherwise<br>
     //------------------------------------------------------------------<br>
     bool<br>
-    WaitForValueEqualTo(T value, const TimeValue *abstime = nullptr, bool *timed_out = nullptr)<br>
+    WaitForValueEqualTo(T value, const std::chrono::microseconds &timeout = std::chrono::microseconds(0),<br>
+                        bool *timed_out = nullptr)<br>
     {<br>
-        int err = 0;<br>
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically<br>
         // unlock the mutex and wait for the condition to be set. When either<br>
         // function returns, they will re-lock the mutex. We use an auto lock/unlock<br>
-        // class (Mutex::Locker) to allow us to return at any point in this<br>
+        // class (std::lock_guard) to allow us to return at any point in this<br>
         // function and not have to worry about unlocking the mutex.<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::unique_lock<std::mutex> lock(m_mutex);<br>
<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
-        printf("%s (value = 0x%8.8x, abstime = %p), m_value = 0x%8.8x\n", __FUNCTION__, value, abstime, m_value);<br>
+        printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, value, timeout.count(),<br>
+               m_value);<br>
 #endif<br>
         if (timed_out)<br>
             *timed_out = false;<br>
<br>
-        while (err == 0 && m_value != value)<br>
+        while (m_value != value)<br>
         {<br>
-            err = m_condition.Wait (m_mutex, abstime, timed_out);<br>
+            if (timeout == std::chrono::microseconds(0))<br>
+            {<br>
+                m_condition.wait(lock);<br>
+            }<br>
+            else<br>
+            {<br>
+                std::cv_status result = m_condition.wait_for(lock, timeout);<br>
+                if (result == std::cv_status::timeout)<br>
+                {<br>
+                    if (timed_out)<br>
+                        *timed_out = true;<br>
+                    break;<br>
+                }<br>
+            }<br>
         }<br>
<br>
         return m_value == value;<br>
@@ -378,26 +410,39 @@ public:<br>
     //------------------------------------------------------------------<br>
     bool<br>
     WaitForValueEqualToAndSetValueTo(T wait_value, T new_value,<br>
-                                     const TimeValue *abstime = nullptr,<br>
+                                     const std::chrono::microseconds &timeout = std::chrono::microseconds(0),<br>
                                      bool *timed_out = nullptr)<br>
     {<br>
-        int err = 0;<br>
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically<br>
         // unlock the mutex and wait for the condition to be set. When either<br>
         // function returns, they will re-lock the mutex. We use an auto lock/unlock<br>
-        // class (Mutex::Locker) to allow us to return at any point in this<br>
+        // class (std::lock_guard) to allow us to return at any point in this<br>
         // function and not have to worry about unlocking the mutex.<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::unique_lock<std::mutex> lock(m_mutex);<br>
<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
-        printf("%s (wait_value = 0x%8.8x, new_value = 0x%8.8x, abstime = %p), m_value = 0x%8.8x\n", __FUNCTION__, wait_value, new_value, abstime, m_value);<br>
+        printf("%s (wait_value = 0x%8.8x, new_value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__,<br>
+               wait_value, new_value, timeout.count(), m_value);<br>
 #endif<br>
         if (timed_out)<br>
             *timed_out = false;<br>
<br>
-        while (err == 0 && m_value != wait_value)<br>
+        while (m_value != wait_value)<br>
         {<br>
-            err = m_condition.Wait (m_mutex, abstime, timed_out);<br>
+            if (timeout == std::chrono::microseconds(0))<br>
+            {<br>
+                m_condition.wait(lock);<br>
+            }<br>
+            else<br>
+            {<br>
+                std::cv_status result = m_condition.wait_for(m_mutex, timeout);<br>
+                if (result == std::cv_status::timeout)<br>
+                {<br>
+                    if (timed_out)<br>
+                        *timed_out = true;<br>
+                    break;<br>
+                }<br>
+            }<br>
         }<br>
<br>
         if (m_value == wait_value)<br>
@@ -438,21 +483,31 @@ public:<br>
     ///     @li \b false otherwise<br>
     //------------------------------------------------------------------<br>
     bool<br>
-    WaitForValueNotEqualTo(T value, T &new_value, const TimeValue *abstime = nullptr)<br>
+    WaitForValueNotEqualTo(T value, T &new_value,<br>
+                           const std::chrono::microseconds &timeout = std::chrono::microseconds(0))<br>
     {<br>
-        int err = 0;<br>
         // pthread_cond_timedwait() or pthread_cond_wait() will atomically<br>
         // unlock the mutex and wait for the condition to be set. When either<br>
         // function returns, they will re-lock the mutex. We use an auto lock/unlock<br>
-        // class (Mutex::Locker) to allow us to return at any point in this<br>
+        // class (std::lock_guard) to allow us to return at any point in this<br>
         // function and not have to worry about unlocking the mutex.<br>
-        Mutex::Locker locker(m_mutex);<br>
+        std::unique_lock<std::mutex> lock(m_mutex);<br>
 #ifdef DB_PTHREAD_LOG_EVENTS<br>
-        printf("%s (value = 0x%8.8x, abstime = %p), m_value = 0x%8.8x\n", __FUNCTION__, value, abstime, m_value);<br>
+        printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, value, timeout.count(),<br>
+               m_value);<br>
 #endif<br>
-        while (err == 0 && m_value == value)<br>
+        while (m_value == value)<br>
         {<br>
-            err = m_condition.Wait (m_mutex, abstime);<br>
+            if (timeout == std::chrono::microseconds(0))<br>
+            {<br>
+                m_condition.wait(lock);<br>
+            }<br>
+            else<br>
+            {<br>
+                std::cv_status result = m_condition.wait_for(lock, timeout);<br>
+                if (result == std::cv_status::timeout)<br>
+                    break;<br>
+            }<br>
         }<br>
<br>
         if (m_value != value)<br>
@@ -469,8 +524,9 @@ protected:<br>
     // blocking between the main thread and the spotlight index thread.<br>
     //----------------------------------------------------------------------<br>
     T           m_value;        ///< The templatized value T that we are protecting access to<br>
-    mutable Mutex m_mutex;      ///< The mutex to use when accessing the data<br>
-    Condition   m_condition;    ///< The pthread condition variable to use for signaling that data available or changed.<br>
+    mutable std::mutex m_mutex; ///< The mutex to use when accessing the data<br>
+    std::condition_variable<br>
+        m_condition; ///< The pthread condition variable to use for signaling that data available or changed.<br>
<br>
 private:<br>
     //------------------------------------------------------------------<br>
@@ -496,7 +552,7 @@ private:<br>
         printf("%s (old_value = 0x%8.8x, broadcast_type = %i) m_value = 0x%8.8x, broadcast = %u\n", __FUNCTION__, old_value, broadcast_type, m_value, broadcast);<br>
 #endif<br>
         if (broadcast)<br>
-            m_condition.Broadcast();<br>
+            m_condition.notify_all();<br>
     }<br>
<br>
     DISALLOW_COPY_AND_ASSIGN(Predicate);<br>
<br>
Modified: lldb/trunk/include/lldb/Host/ProcessRunLock.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ProcessRunLock.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ProcessRunLock.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Host/ProcessRunLock.h (original)<br>
+++ lldb/trunk/include/lldb/Host/ProcessRunLock.h Thu Jul 28 12:32:20 2016<br>
@@ -18,7 +18,6 @@<br>
 // Other libraries and framework includes<br>
 // Project includes<br>
 #include "lldb/lldb-defines.h"<br>
-#include "lldb/Host/Condition.h"<br>
<br>
 //----------------------------------------------------------------------<br>
 /// Enumerations for broadcasting.<br>
<br>
Modified: lldb/trunk/include/lldb/Target/Process.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Target/Process.h (original)<br>
+++ lldb/trunk/include/lldb/Target/Process.h Thu Jul 28 12:32:20 2016<br>
@@ -16,6 +16,7 @@<br>
 #include <limits.h><br>
<br>
 // C++ Includes<br>
+#include <chrono><br>
 #include <list><br>
 #include <memory><br>
 #include <mutex><br>
@@ -2920,12 +2921,9 @@ public:<br>
     // function releases the run lock after the stop. Setting use_run_lock to false<br>
     // will avoid this behavior.<br>
     lldb::StateType<br>
-    WaitForProcessToStop(const TimeValue *timeout,<br>
-                         lldb::EventSP *event_sp_ptr = nullptr,<br>
-                         bool wait_always = true,<br>
-                         lldb::ListenerSP hijack_listener = lldb::ListenerSP(),<br>
-                         Stream *stream = nullptr,<br>
-                         bool use_run_lock = true);<br>
+    WaitForProcessToStop(const std::chrono::microseconds &timeout, lldb::EventSP *event_sp_ptr = nullptr,<br>
+                         bool wait_always = true, lldb::ListenerSP hijack_listener = lldb::ListenerSP(),<br>
+                         Stream *stream = nullptr, bool use_run_lock = true);<br>
<br>
     uint32_t<br>
     GetIOHandlerID () const<br>
@@ -2947,8 +2945,7 @@ public:<br>
     SyncIOHandler (uint32_t iohandler_id, uint64_t timeout_msec);<br>
<br>
     lldb::StateType<br>
-    WaitForStateChangedEvents(const TimeValue *timeout,<br>
-                              lldb::EventSP &event_sp,<br>
+    WaitForStateChangedEvents(const std::chrono::microseconds &timeout, lldb::EventSP &event_sp,<br>
                               lldb::ListenerSP hijack_listener); // Pass an empty ListenerSP to use builtin listener<br>
<br>
     //--------------------------------------------------------------------------------------<br>
@@ -3538,21 +3535,20 @@ protected:<br>
     HaltPrivate();<br>
<br>
     lldb::StateType<br>
-    WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP &event_sp);<br>
+    WaitForProcessStopPrivate(const std::chrono::microseconds &timeout, lldb::EventSP &event_sp);<br>
<br>
     // This waits for both the state change broadcaster, and the control broadcaster.<br>
     // If control_only, it only waits for the control broadcaster.<br>
<br>
     bool<br>
-    WaitForEventsPrivate (const TimeValue *timeout, lldb::EventSP &event_sp, bool control_only);<br>
+    WaitForEventsPrivate(const std::chrono::microseconds &timeout, lldb::EventSP &event_sp, bool control_only);<br>
<br>
     lldb::StateType<br>
-    WaitForStateChangedEventsPrivate (const TimeValue *timeout, lldb::EventSP &event_sp);<br>
+    WaitForStateChangedEventsPrivate(const std::chrono::microseconds &timeout, lldb::EventSP &event_sp);<br>
<br>
     lldb::StateType<br>
-    WaitForState (const TimeValue *timeout,<br>
-                  const lldb::StateType *match_states,<br>
-                  const uint32_t num_match_states);<br>
+    WaitForState(const std::chrono::microseconds &timeout, const lldb::StateType *match_states,<br>
+                 const uint32_t num_match_states);<br>
<br>
     size_t<br>
     WriteMemoryPrivate (lldb::addr_t addr, const void *buf, size_t size, Error &error);<br>
<br>
Modified: lldb/trunk/source/API/SBListener.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/API/SBListener.cpp (original)<br>
+++ lldb/trunk/source/API/SBListener.cpp Thu Jul 28 12:32:20 2016<br>
@@ -17,7 +17,6 @@<br>
 #include "lldb/Core/Listener.h"<br>
 #include "lldb/Core/Log.h"<br>
 #include "lldb/Core/StreamString.h"<br>
-#include "lldb/Host/TimeValue.h"<br>
<br>
<br>
 using namespace lldb;<br>
@@ -202,15 +201,14 @@ SBListener::WaitForEvent (uint32_t timeo<br>
<br>
     if (m_opaque_sp)<br>
     {<br>
-        TimeValue time_value;<br>
+        std::chrono::microseconds timeout = std::chrono::microseconds(0);<br>
         if (timeout_secs != UINT32_MAX)<br>
         {<br>
             assert (timeout_secs != 0); // Take this out after all calls with timeout set to zero have been removed....<br>
-            time_value = TimeValue::Now();<br>
-            time_value.OffsetWithSeconds (timeout_secs);<br>
+            timeout = std::chrono::seconds(timeout_secs);<br>
         }<br>
         EventSP event_sp;<br>
-        if (m_opaque_sp->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))<br>
+        if (m_opaque_sp->WaitForEvent(timeout, event_sp))<br>
         {<br>
             event.reset (event_sp);<br>
             success = true;<br>
@@ -247,16 +245,11 @@ SBListener::WaitForEventForBroadcaster<br>
 {<br>
     if (m_opaque_sp && broadcaster.IsValid())<br>
     {<br>
-        TimeValue time_value;<br>
+        std::chrono::microseconds timeout = std::chrono::microseconds(0);<br>
         if (num_seconds != UINT32_MAX)<br>
-        {<br>
-            time_value = TimeValue::Now();<br>
-            time_value.OffsetWithSeconds (num_seconds);<br>
-        }<br>
+            timeout = std::chrono::seconds(num_seconds);<br>
         EventSP event_sp;<br>
-        if (m_opaque_sp->WaitForEventForBroadcaster (time_value.IsValid() ? &time_value : NULL,<br>
-                                                         broadcaster.get(),<br>
-                                                         event_sp))<br>
+        if (m_opaque_sp->WaitForEventForBroadcaster(timeout, broadcaster.get(), event_sp))<br>
         {<br>
             event.reset (event_sp);<br>
             return true;<br>
@@ -278,17 +271,11 @@ SBListener::WaitForEventForBroadcasterWi<br>
 {<br>
     if (m_opaque_sp && broadcaster.IsValid())<br>
     {<br>
-        TimeValue time_value;<br>
+        std::chrono::microseconds timeout = std::chrono::microseconds(0);<br>
         if (num_seconds != UINT32_MAX)<br>
-        {<br>
-            time_value = TimeValue::Now();<br>
-            time_value.OffsetWithSeconds (num_seconds);<br>
-        }<br>
+            timeout = std::chrono::seconds(num_seconds);<br>
         EventSP event_sp;<br>
-        if (m_opaque_sp->WaitForEventForBroadcasterWithType (time_value.IsValid() ? &time_value : NULL,<br>
-                                                              broadcaster.get(),<br>
-                                                              event_type_mask,<br>
-                                                              event_sp))<br>
+        if (m_opaque_sp->WaitForEventForBroadcasterWithType(timeout, broadcaster.get(), event_type_mask, event_sp))<br>
         {<br>
             event.reset (event_sp);<br>
             return true;<br>
<br>
Modified: lldb/trunk/source/Core/Communication.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Core/Communication.cpp (original)<br>
+++ lldb/trunk/source/Core/Communication.cpp Thu Jul 28 12:32:20 2016<br>
@@ -156,18 +156,14 @@ Communication::Read (void *dst, size_t d<br>
             status = eConnectionStatusNoConnection;<br>
             return 0;<br>
         }<br>
-        // Set the timeout appropriately<br>
-        TimeValue timeout_time;<br>
-        if (timeout_usec != UINT32_MAX)<br>
-        {<br>
-            timeout_time = TimeValue::Now();<br>
-            timeout_time.OffsetWithMicroSeconds (timeout_usec);<br>
-        }<br>
<br>
         ListenerSP listener_sp(Listener::MakeListener("Communication::Read"));<br>
         listener_sp->StartListeningForEvents (this, eBroadcastBitReadThreadGotBytes | eBroadcastBitReadThreadDidExit);<br>
         EventSP event_sp;<br>
-        while (listener_sp->WaitForEvent (timeout_time.IsValid() ? &timeout_time : nullptr, event_sp))<br>
+        std::chrono::microseconds timeout = std::chrono::microseconds(0);<br>
+        if (timeout_usec != UINT32_MAX)<br>
+            timeout = std::chrono::microseconds(timeout_usec);<br>
+        while (listener_sp->WaitForEvent(timeout, event_sp))<br>
         {<br>
             const uint32_t event_type = event_sp->GetType();<br>
             if (event_type & eBroadcastBitReadThreadGotBytes)<br>
@@ -439,7 +435,7 @@ Communication::SynchronizeWithReadThread<br>
<br>
     // Wait for the synchronization event.<br>
     EventSP event_sp;<br>
-    listener_sp->WaitForEvent(nullptr, event_sp);<br>
+    listener_sp->WaitForEvent(std::chrono::microseconds(0), event_sp);<br>
 }<br>
<br>
 void<br>
<br>
Modified: lldb/trunk/source/Core/Debugger.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Core/Debugger.cpp (original)<br>
+++ lldb/trunk/source/Core/Debugger.cpp Thu Jul 28 12:32:20 2016<br>
@@ -1608,7 +1608,7 @@ Debugger::DefaultEventHandler()<br>
     while (!done)<br>
     {<br>
         EventSP event_sp;<br>
-        if (listener_sp->WaitForEvent(nullptr, event_sp))<br>
+        if (listener_sp->WaitForEvent(std::chrono::microseconds(0), event_sp))<br>
         {<br>
             if (event_sp)<br>
             {<br>
@@ -1705,7 +1705,7 @@ Debugger::StartEventHandlerThread()<br>
         // eBroadcastBitEventThreadIsListening so we don't need to check the event, we just need<br>
         // to wait an infinite amount of time for it (nullptr timeout as the first parameter)<br>
         lldb::EventSP event_sp;<br>
-        listener_sp->WaitForEvent(nullptr, event_sp);<br>
+        listener_sp->WaitForEvent(std::chrono::microseconds(0), event_sp);<br>
     }<br>
     return m_event_handler_thread.IsJoinable();<br>
 }<br>
<br>
Modified: lldb/trunk/source/Core/Listener.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Core/Listener.cpp (original)<br>
+++ lldb/trunk/source/Core/Listener.cpp Thu Jul 28 12:32:20 2016<br>
@@ -19,7 +19,6 @@<br>
 #include "lldb/Core/Log.h"<br>
 #include "lldb/Core/StreamString.h"<br>
 #include "lldb/Core/Event.h"<br>
-#include "lldb/Host/TimeValue.h"<br>
<br>
 using namespace lldb;<br>
 using namespace lldb_private;<br>
@@ -41,7 +40,7 @@ namespace<br>
 } // anonymous namespace<br>
<br>
 Listener::Listener(const char *name)<br>
-    : m_name(name), m_broadcasters(), m_broadcasters_mutex(), m_events(), m_events_mutex(Mutex::eMutexTypeNormal)<br>
+    : m_name(name), m_broadcasters(), m_broadcasters_mutex(), m_events(), m_events_mutex()<br>
 {<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));<br>
     if (log != nullptr)<br>
@@ -63,7 +62,7 @@ void<br>
 Listener::Clear()<br>
 {<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));<br>
-    std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);<br>
+    std::lock_guard<std::recursive_mutex> broadcasters_guard(m_broadcasters_mutex);<br>
     broadcaster_collection::iterator pos, end = m_broadcasters.end();<br>
     for (pos = m_broadcasters.begin(); pos != end; ++pos)<br>
     {<br>
@@ -73,7 +72,7 @@ Listener::Clear()<br>
     }<br>
     m_broadcasters.clear();<br>
<br>
-    Mutex::Locker event_locker(m_events_mutex);<br>
+    std::lock_guard<std::mutex> events_guard(m_events_mutex);<br>
     m_events.clear();<br>
     size_t num_managers = m_broadcaster_managers.size();<br>
<br>
@@ -96,7 +95,7 @@ Listener::StartListeningForEvents (Broad<br>
         // Scope for "locker"<br>
         // Tell the broadcaster to add this object as a listener<br>
         {<br>
-            std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);<br>
+            std::lock_guard<std::recursive_mutex> broadcasters_guard(m_broadcasters_mutex);<br>
             Broadcaster::BroadcasterImplWP impl_wp(broadcaster->GetBroadcasterImpl());<br>
             m_broadcasters.insert(std::make_pair(impl_wp, BroadcasterInfo(event_mask)));<br>
         }<br>
@@ -123,7 +122,7 @@ Listener::StartListeningForEvents (Broad<br>
         // Scope for "locker"<br>
         // Tell the broadcaster to add this object as a listener<br>
         {<br>
-            std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);<br>
+            std::lock_guard<std::recursive_mutex> broadcasters_guard(m_broadcasters_mutex);<br>
             Broadcaster::BroadcasterImplWP impl_wp(broadcaster->GetBroadcasterImpl());<br>
             m_broadcasters.insert(std::make_pair(impl_wp,<br>
                                                  BroadcasterInfo(event_mask, callback, callback_user_data)));<br>
@@ -154,7 +153,7 @@ Listener::StopListeningForEvents (Broadc<br>
     {<br>
         // Scope for "locker"<br>
         {<br>
-            std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);<br>
+            std::lock_guard<std::recursive_mutex> broadcasters_guard(m_broadcasters_mutex);<br>
             m_broadcasters.erase (broadcaster->GetBroadcasterImpl());<br>
         }<br>
         // Remove the broadcaster from our set of broadcasters<br>
@@ -171,13 +170,13 @@ Listener::BroadcasterWillDestruct (Broad<br>
 {<br>
     // Scope for "broadcasters_locker"<br>
     {<br>
-        std::lock_guard<std::recursive_mutex> guard(m_broadcasters_mutex);<br>
+        std::lock_guard<std::recursive_mutex> broadcasters_guard(m_broadcasters_mutex);<br>
         m_broadcasters.erase (broadcaster->GetBroadcasterImpl());<br>
     }<br>
<br>
     // Scope for "event_locker"<br>
     {<br>
-        Mutex::Locker event_locker(m_events_mutex);<br>
+        std::lock_guard<std::mutex> events_guard(m_events_mutex);<br>
         // Remove all events for this broadcaster object.<br>
         event_collection::iterator pos = m_events.begin();<br>
         while (pos != m_events.end())<br>
@@ -212,9 +211,9 @@ Listener::AddEvent (EventSP &event_sp)<br>
                      static_cast<void*>(this), m_name.c_str(),<br>
                      static_cast<void*>(event_sp.get()));<br>
<br>
-    Mutex::Locker locker(m_events_mutex);<br>
+    std::lock_guard<std::mutex> guard(m_events_mutex);<br>
     m_events.push_back (event_sp);<br>
-    m_events_condition.Broadcast();<br>
+    m_events_condition.notify_all();<br>
 }<br>
<br>
 class EventBroadcasterMatches<br>
@@ -279,15 +278,11 @@ private:<br>
 };<br>
<br>
 bool<br>
-Listener::FindNextEventInternal<br>
-(<br>
-    Mutex::Locker& lock,<br>
-    Broadcaster *broadcaster,   // nullptr for any broadcaster<br>
-    const ConstString *broadcaster_names, // nullptr for any event<br>
-    uint32_t num_broadcaster_names,<br>
-    uint32_t event_type_mask,<br>
-    EventSP &event_sp,<br>
-    bool remove)<br>
+Listener::FindNextEventInternal(std::unique_lock<std::mutex> &lock,<br>
+                                Broadcaster *broadcaster,             // nullptr for any broadcaster<br>
+                                const ConstString *broadcaster_names, // nullptr for any event<br>
+                                uint32_t num_broadcaster_names, uint32_t event_type_mask, EventSP &event_sp,<br>
+                                bool remove)<br>
 {<br>
     // NOTE: callers of this function must lock m_events_mutex using a Mutex::Locker<br>
     // and pass the locker as the first argument. m_events_mutex is no longer recursive.<br>
@@ -325,7 +320,7 @@ Listener::FindNextEventInternal<br>
             // Unlock the event queue here.  We've removed this event and are about to return<br>
             // it so it should be okay to get the next event off the queue here - and it might<br>
             // be useful to do that in the "DoOnRemoval".<br>
-            lock.Unlock();<br>
+            lock.unlock();<br>
             event_sp->DoOnRemoval();<br>
         }<br>
         return true;<br>
@@ -338,9 +333,9 @@ Listener::FindNextEventInternal<br>
 Event *<br>
 Listener::PeekAtNextEvent ()<br>
 {<br>
-    Mutex::Locker lock(m_events_mutex);<br>
+    std::unique_lock<std::mutex> guard(m_events_mutex);<br>
     EventSP event_sp;<br>
-    if (FindNextEventInternal(lock, nullptr, nullptr, 0, 0, event_sp, false))<br>
+    if (FindNextEventInternal(guard, nullptr, nullptr, 0, 0, event_sp, false))<br>
         return event_sp.get();<br>
     return nullptr;<br>
 }<br>
@@ -348,9 +343,9 @@ Listener::PeekAtNextEvent ()<br>
 Event *<br>
 Listener::PeekAtNextEventForBroadcaster (Broadcaster *broadcaster)<br>
 {<br>
-    Mutex::Locker lock(m_events_mutex);<br>
+    std::unique_lock<std::mutex> guard(m_events_mutex);<br>
     EventSP event_sp;<br>
-    if (FindNextEventInternal(lock, broadcaster, nullptr, 0, 0, event_sp, false))<br>
+    if (FindNextEventInternal(guard, broadcaster, nullptr, 0, 0, event_sp, false))<br>
         return event_sp.get();<br>
     return nullptr;<br>
 }<br>
@@ -358,9 +353,9 @@ Listener::PeekAtNextEventForBroadcaster<br>
 Event *<br>
 Listener::PeekAtNextEventForBroadcasterWithType (Broadcaster *broadcaster, uint32_t event_type_mask)<br>
 {<br>
-    Mutex::Locker lock(m_events_mutex);<br>
+    std::unique_lock<std::mutex> guard(m_events_mutex);<br>
     EventSP event_sp;<br>
-    if (FindNextEventInternal(lock, broadcaster, nullptr, 0, event_type_mask, event_sp, false))<br>
+    if (FindNextEventInternal(guard, broadcaster, nullptr, 0, event_type_mask, event_sp, false))<br>
         return event_sp.get();<br>
     return nullptr;<br>
 }<br>
@@ -372,8 +367,9 @@ Listener::GetNextEventInternal(Broadcast<br>
                                uint32_t event_type_mask,<br>
                                EventSP &event_sp)<br>
 {<br>
-    Mutex::Locker lock(m_events_mutex);<br>
-    return FindNextEventInternal (lock, broadcaster, broadcaster_names, num_broadcaster_names, event_type_mask, event_sp, true);<br>
+    std::unique_lock<std::mutex> guard(m_events_mutex);<br>
+    return FindNextEventInternal(guard, broadcaster, broadcaster_names, num_broadcaster_names, event_type_mask,<br>
+                                 event_sp, true);<br>
 }<br>
<br>
 bool<br>
@@ -395,20 +391,17 @@ Listener::GetNextEventForBroadcasterWith<br>
 }<br>
<br>
 bool<br>
-Listener::WaitForEventsInternal(const TimeValue *timeout,<br>
+Listener::WaitForEventsInternal(const std::chrono::microseconds &timeout,<br>
                                 Broadcaster *broadcaster,             // nullptr for any broadcaster<br>
                                 const ConstString *broadcaster_names, // nullptr for any event<br>
-                                uint32_t num_broadcaster_names,<br>
-                                uint32_t event_type_mask,<br>
-                                EventSP &event_sp)<br>
+                                uint32_t num_broadcaster_names, uint32_t event_type_mask, EventSP &event_sp)<br>
 {<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));<br>
     if (log != nullptr)<br>
-        log->Printf ("%p Listener::WaitForEventsInternal (timeout = { %p }) for %s",<br>
-                     static_cast<void*>(this), static_cast<const void*>(timeout),<br>
-                     m_name.c_str());<br>
+        log->Printf("%p Listener::WaitForEventsInternal (timeout = %llu us) for %s", static_cast<void *>(this),<br>
+                    static_cast<unsigned long long>(timeout.count()), m_name.c_str());<br>
<br>
-    Mutex::Locker lock(m_events_mutex);<br>
+    std::unique_lock<std::mutex> lock(m_events_mutex);<br>
<br>
     while (true)<br>
     {<br>
@@ -418,23 +411,26 @@ Listener::WaitForEventsInternal(const Ti<br>
         }<br>
         else<br>
         {<br>
-            bool timed_out = false;<br>
-            if (m_events_condition.Wait(m_events_mutex, timeout, &timed_out) != 0)<br>
+            std::cv_status result = std::cv_status::no_timeout;<br>
+            if (timeout == std::chrono::microseconds(0))<br>
+                m_events_condition.wait(lock);<br>
+            else<br>
+                result = m_events_condition.wait_for(lock, timeout);<br>
+<br>
+            if (result == std::cv_status::timeout)<br>
             {<br>
-                if (timed_out)<br>
-                {<br>
-                    log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);<br>
-                    if (log != nullptr)<br>
-                        log->Printf ("%p Listener::WaitForEventsInternal() timed out for %s",<br>
-                                     static_cast<void*>(this), m_name.c_str());<br>
-                }<br>
-                else<br>
-                {<br>
-                    log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);<br>
-                    if (log != nullptr)<br>
-                        log->Printf ("%p Listener::WaitForEventsInternal() unknown error for %s",<br>
-                                     static_cast<void*>(this), m_name.c_str());<br>
-                }<br>
+              log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);<br>
+              if (log)<br>
+                  log->Printf("%p Listener::WaitForEventsInternal() timed out for %s", static_cast<void *>(this),<br>
+                              m_name.c_str());<br>
+              return false;<br>
+            }<br>
+            else if (result != std::cv_status::no_timeout)<br>
+            {<br>
+                log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);<br>
+                if (log)<br>
+                    log->Printf("%p Listener::WaitForEventsInternal() unknown error for %s", static_cast<void *>(this),<br>
+                                m_name.c_str());<br>
                 return false;<br>
             }<br>
         }<br>
@@ -444,24 +440,21 @@ Listener::WaitForEventsInternal(const Ti<br>
 }<br>
<br>
 bool<br>
-Listener::WaitForEventForBroadcasterWithType(const TimeValue *timeout,<br>
-                                             Broadcaster *broadcaster,<br>
-                                             uint32_t event_type_mask,<br>
-                                             EventSP &event_sp)<br>
+Listener::WaitForEventForBroadcasterWithType(const std::chrono::microseconds &timeout, Broadcaster *broadcaster,<br>
+                                             uint32_t event_type_mask, EventSP &event_sp)<br>
 {<br>
     return WaitForEventsInternal(timeout, broadcaster, nullptr, 0, event_type_mask, event_sp);<br>
 }<br>
<br>
 bool<br>
-Listener::WaitForEventForBroadcaster(const TimeValue *timeout,<br>
-                                     Broadcaster *broadcaster,<br>
+Listener::WaitForEventForBroadcaster(const std::chrono::microseconds &timeout, Broadcaster *broadcaster,<br>
                                      EventSP &event_sp)<br>
 {<br>
     return WaitForEventsInternal(timeout, broadcaster, nullptr, 0, 0, event_sp);<br>
 }<br>
<br>
 bool<br>
-Listener::WaitForEvent (const TimeValue *timeout, EventSP &event_sp)<br>
+Listener::WaitForEvent(const std::chrono::microseconds &timeout, EventSP &event_sp)<br>
 {<br>
     return WaitForEventsInternal(timeout, nullptr, nullptr, 0, 0, event_sp);<br>
 }<br>
<br>
Modified: lldb/trunk/source/Host/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/CMakeLists.txt (original)<br>
+++ lldb/trunk/source/Host/CMakeLists.txt Thu Jul 28 12:32:20 2016<br>
@@ -4,7 +4,6 @@ macro(add_host_subdirectory group)<br>
 endmacro()<br>
<br>
 add_host_subdirectory(common<br>
-  common/Condition.cpp<br>
   common/File.cpp<br>
   common/FileCache.cpp<br>
   common/FileSpec.cpp<br>
@@ -17,7 +16,6 @@ add_host_subdirectory(common<br>
   common/HostThread.cpp<br>
   common/IOObject.cpp<br>
   common/LockFileBase.cpp<br>
-  common/Mutex.cpp<br>
   common/MonitoringProcessLauncher.cpp<br>
   common/NativeBreakpoint.cpp<br>
   common/NativeBreakpointList.cpp<br>
@@ -60,7 +58,6 @@ add_host_subdirectory(posix<br>
<br>
 if (CMAKE_SYSTEM_NAME MATCHES "Windows")<br>
   add_host_subdirectory(windows<br>
-    windows/Condition.cpp<br>
     windows/ConnectionGenericFileWindows.cpp<br>
     windows/EditLineWin.cpp<br>
     windows/FileSystem.cpp<br>
@@ -69,7 +66,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")<br>
     windows/HostProcessWindows.cpp<br>
     windows/HostThreadWindows.cpp<br>
     windows/LockFileWindows.cpp<br>
-    windows/Mutex.cpp<br>
     windows/PipeWindows.cpp<br>
     windows/ProcessLauncherWindows.cpp<br>
     windows/ProcessRunLock.cpp<br>
<br>
Removed: lldb/trunk/source/Host/common/Condition.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Condition.cpp?rev=277010&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Condition.cpp?rev=277010&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/common/Condition.cpp (original)<br>
+++ lldb/trunk/source/Host/common/Condition.cpp (removed)<br>
@@ -1,108 +0,0 @@<br>
-//===-- Condition.cpp -------------------------------------------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include <errno.h><br>
-<br>
-#include "lldb/Host/Condition.h"<br>
-#include "lldb/Host/TimeValue.h"<br>
-<br>
-<br>
-using namespace lldb_private;<br>
-<br>
-#ifndef _WIN32<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor<br>
-//<br>
-// The default constructor will initialize a new pthread condition<br>
-// and maintain the condition in the object state.<br>
-//----------------------------------------------------------------------<br>
-Condition::Condition () :<br>
-    m_condition()<br>
-{<br>
-    ::pthread_cond_init (&m_condition, NULL);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Destructor<br>
-//<br>
-// Destroys the pthread condition that the object owns.<br>
-//----------------------------------------------------------------------<br>
-Condition::~Condition ()<br>
-{<br>
-    ::pthread_cond_destroy (&m_condition);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Unblock all threads waiting for a condition variable<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Condition::Broadcast ()<br>
-{<br>
-    return ::pthread_cond_broadcast (&m_condition);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Unblocks one thread waiting for the condition variable<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Condition::Signal ()<br>
-{<br>
-    return ::pthread_cond_signal (&m_condition);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// The Wait() function atomically blocks the current thread<br>
-// waiting on the owned condition variable, and unblocks the mutex<br>
-// specified by "mutex".  The waiting thread unblocks only after<br>
-// another thread calls Signal(), or Broadcast() with the same<br>
-// condition variable, or if "abstime" is valid (non-NULL) this<br>
-// function will return when the system time reaches the time<br>
-// specified in "abstime". If "abstime" is NULL this function will<br>
-// wait for an infinite amount of time for the condition variable<br>
-// to be signaled or broadcasted.<br>
-//<br>
-// The current thread re-acquires the lock on "mutex".<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Condition::Wait (Mutex &mutex, const TimeValue *abstime, bool *timed_out)<br>
-{<br>
-    int err = 0;<br>
-    do<br>
-    {<br>
-        if (abstime && abstime->IsValid())<br>
-        {<br>
-            struct timespec abstime_ts = abstime->GetAsTimeSpec();<br>
-            err = ::pthread_cond_timedwait (&m_condition, mutex.GetMutex(), &abstime_ts);<br>
-        }<br>
-        else<br>
-            err = ::pthread_cond_wait (&m_condition, mutex.GetMutex());<br>
-    } while (err == EINTR);<br>
-<br>
-    if (timed_out != NULL)<br>
-    {<br>
-        if (err == ETIMEDOUT)<br>
-            *timed_out = true;<br>
-        else<br>
-            *timed_out = false;<br>
-    }<br>
-<br>
-    return err;<br>
-}<br>
-<br>
-#endif<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Get accessor to the pthread condition object<br>
-//----------------------------------------------------------------------<br>
-lldb::condition_t *<br>
-Condition::GetCondition()<br>
-{<br>
-    return &m_condition;<br>
-}<br>
<br>
Modified: lldb/trunk/source/Host/common/Host.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/common/Host.cpp (original)<br>
+++ lldb/trunk/source/Host/common/Host.cpp Thu Jul 28 12:32:20 2016<br>
@@ -620,14 +620,8 @@ Host::RunShellCommand(const Args &args,<br>
<br>
     if (error.Success())<br>
     {<br>
-        TimeValue *timeout_ptr = nullptr;<br>
-        TimeValue timeout_time(TimeValue::Now());<br>
-        if (timeout_sec > 0) {<br>
-            timeout_time.OffsetWithSeconds(timeout_sec);<br>
-            timeout_ptr = &timeout_time;<br>
-        }<br>
         bool timed_out = false;<br>
-        shell_info_sp->process_reaped.WaitForValueEqualTo(true, timeout_ptr, &timed_out);<br>
+        shell_info_sp->process_reaped.WaitForValueEqualTo(true, std::chrono::seconds(timeout_sec), &timed_out);<br>
         if (timed_out)<br>
         {<br>
             error.SetErrorString("timed out waiting for shell command to complete");<br>
@@ -635,10 +629,8 @@ Host::RunShellCommand(const Args &args,<br>
             // Kill the process since it didn't complete within the timeout specified<br>
             Kill (pid, SIGKILL);<br>
             // Wait for the monitor callback to get the message<br>
-            timeout_time = TimeValue::Now();<br>
-            timeout_time.OffsetWithSeconds(1);<br>
             timed_out = false;<br>
-            shell_info_sp->process_reaped.WaitForValueEqualTo(true, &timeout_time, &timed_out);<br>
+            shell_info_sp->process_reaped.WaitForValueEqualTo(true, std::chrono::seconds(1), &timed_out);<br>
         }<br>
         else<br>
         {<br>
<br>
Removed: lldb/trunk/source/Host/common/Mutex.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=277010&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=277010&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/common/Mutex.cpp (original)<br>
+++ lldb/trunk/source/Host/common/Mutex.cpp (removed)<br>
@@ -1,398 +0,0 @@<br>
-//===-- Mutex.cpp -----------------------------------------------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "lldb/Host/Mutex.h"<br>
-#include "lldb/Host/Host.h"<br>
-<br>
-#ifndef _WIN32<br>
-#include <pthread.h><br>
-#endif<br>
-#include <string.h><br>
-#include <stdio.h><br>
-<br>
-#if 0<br>
-// This logging is way too verbose to enable even for a log channel.<br>
-// This logging can be enabled by changing the "#if 0", but should be<br>
-// reverted prior to checking in.<br>
-#include <cstdio><br>
-#define DEBUG_LOG(fmt, ...) printf(fmt, ## __VA_ARGS__)<br>
-#else<br>
-#define DEBUG_LOG(fmt, ...)<br>
-#endif<br>
-<br>
-// Enable extra mutex error checking<br>
-#if 0 // LLDB_CONFIGURATION_DEBUG<br>
-#define ENABLE_MUTEX_ERROR_CHECKING 1<br>
-#include <inttypes.h><br>
-#endif<br>
-<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-#include <set><br>
-<br>
-enum MutexAction<br>
-{<br>
-    eMutexActionInitialized,<br>
-    eMutexActionDestroyed,<br>
-    eMutexActionAssertInitialized<br>
-};<br>
-<br>
-static bool<br>
-error_check_mutex (pthread_mutex_t *m, MutexAction action)<br>
-{<br>
-    typedef std::set<pthread_mutex_t *> mutex_set;<br>
-    static pthread_mutex_t g_mutex_set_mutex = PTHREAD_MUTEX_INITIALIZER;<br>
-    static mutex_set g_initialized_mutex_set;<br>
-    static mutex_set g_destroyed_mutex_set;<br>
-<br>
-    bool success = true;<br>
-    int err;<br>
-    // Manually call lock so we don't to any of this error checking<br>
-    err = ::pthread_mutex_lock (&g_mutex_set_mutex);<br>
-    assert(err == 0);<br>
-    switch (action)<br>
-    {<br>
-        case eMutexActionInitialized:<br>
-            // Make sure this isn't already in our initialized mutex set...<br>
-            assert (g_initialized_mutex_set.find(m) == g_initialized_mutex_set.end());<br>
-            // Remove this from the destroyed set in case it was ever in there<br>
-            g_destroyed_mutex_set.erase(m);<br>
-            // Add the mutex to the initialized set<br>
-            g_initialized_mutex_set.insert(m);<br>
-            break;<br>
-<br>
-        case eMutexActionDestroyed:<br>
-            // Make sure this isn't already in our destroyed mutex set...<br>
-            assert (g_destroyed_mutex_set.find(m) == g_destroyed_mutex_set.end());<br>
-            // Remove this from the initialized so we can put it into the destroyed set<br>
-            g_initialized_mutex_set.erase(m);<br>
-            // Add the mutex to the destroyed set<br>
-            g_destroyed_mutex_set.insert(m);<br>
-            break;<br>
-        case eMutexActionAssertInitialized:<br>
-            // This function will return true if "m" is in the initialized mutex set<br>
-            success = g_initialized_mutex_set.find(m) != g_initialized_mutex_set.end();<br>
-            assert (success);<br>
-            break;<br>
-    }<br>
-    // Manually call unlock so we don't to any of this error checking<br>
-    err = ::pthread_mutex_unlock (&g_mutex_set_mutex);<br>
-    assert(err == 0);<br>
-    return success;<br>
-}<br>
-<br>
-#endif<br>
-<br>
-using namespace lldb_private;<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor.<br>
-//<br>
-// This will create a scoped mutex locking object that doesn't have<br>
-// a mutex to lock. One will need to be provided using the Reset()<br>
-// method.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Locker::Locker () :<br>
-    m_mutex_ptr(NULL)<br>
-{<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Constructor with a Mutex object.<br>
-//<br>
-// This will create a scoped mutex locking object that extracts the<br>
-// mutex owned by "m" and locks it.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Locker::Locker (Mutex& m) :<br>
-    m_mutex_ptr(NULL)<br>
-{<br>
-    Lock (m);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Constructor with a Mutex object pointer.<br>
-//<br>
-// This will create a scoped mutex locking object that extracts the<br>
-// mutex owned by "m" and locks it.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Locker::Locker (Mutex* m) :<br>
-    m_mutex_ptr(NULL)<br>
-{<br>
-    if (m)<br>
-        Lock (m);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Destructor<br>
-//<br>
-// Unlocks any owned mutex object (if it is valid).<br>
-//----------------------------------------------------------------------<br>
-Mutex::Locker::~Locker ()<br>
-{<br>
-    Unlock();<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Unlock the current mutex in this object (if this owns a valid<br>
-// mutex) and lock the new "mutex" object if it is non-NULL.<br>
-//----------------------------------------------------------------------<br>
-void<br>
-Mutex::Locker::Lock (Mutex &mutex)<br>
-{<br>
-    // We already have this mutex locked or both are NULL...<br>
-    if (m_mutex_ptr == &mutex)<br>
-        return;<br>
-<br>
-    Unlock ();<br>
-<br>
-    m_mutex_ptr = &mutex;<br>
-    m_mutex_ptr->Lock();<br>
-}<br>
-<br>
-void<br>
-Mutex::Locker::Unlock ()<br>
-{<br>
-    if (m_mutex_ptr)<br>
-    {<br>
-        m_mutex_ptr->Unlock ();<br>
-        m_mutex_ptr = NULL;<br>
-    }<br>
-}<br>
-<br>
-bool<br>
-Mutex::Locker::TryLock (Mutex &mutex, const char *failure_message)<br>
-{<br>
-    // We already have this mutex locked!<br>
-    if (m_mutex_ptr == &mutex)<br>
-        return true;<br>
-<br>
-    Unlock ();<br>
-<br>
-    if (mutex.TryLock(failure_message) == 0)<br>
-        m_mutex_ptr = &mutex;<br>
-<br>
-    return m_mutex_ptr != NULL;<br>
-}<br>
-<br>
-#ifndef _WIN32<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor.<br>
-//<br>
-// Creates a pthread mutex with no attributes.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Mutex () :<br>
-    m_mutex()<br>
-{<br>
-    int err;<br>
-    err = ::pthread_mutex_init (&m_mutex, NULL);<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    if (err == 0)<br>
-        error_check_mutex (&m_mutex, eMutexActionInitialized);<br>
-#endif<br>
-    assert(err == 0);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor.<br>
-//<br>
-// Creates a pthread mutex with "type" as the mutex type.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Mutex (Mutex::Type type) :<br>
-    m_mutex()<br>
-{<br>
-    int err;<br>
-    ::pthread_mutexattr_t attr;<br>
-    err = ::pthread_mutexattr_init (&attr);<br>
-    assert(err == 0);<br>
-    switch (type)<br>
-    {<br>
-    case eMutexTypeNormal:<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-        err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ERRORCHECK);<br>
-#else<br>
-        err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL);<br>
-#endif<br>
-        break;<br>
-<br>
-    case eMutexTypeRecursive:<br>
-        err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);<br>
-        break;<br>
-    }<br>
-    assert(err == 0);<br>
-    err = ::pthread_mutex_init (&m_mutex, &attr);<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    if (err == 0)<br>
-        error_check_mutex (&m_mutex, eMutexActionInitialized);<br>
-#endif<br>
-    assert(err == 0);<br>
-    err = ::pthread_mutexattr_destroy (&attr);<br>
-    assert(err == 0);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Destructor.<br>
-//<br>
-// Destroys the mutex owned by this object.<br>
-//----------------------------------------------------------------------<br>
-Mutex::~Mutex()<br>
-{<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    int err = ::pthread_mutex_destroy (&m_mutex);<br>
-    assert(err == 0);<br>
-    if (err == 0)<br>
-        error_check_mutex (&m_mutex, eMutexActionDestroyed);<br>
-    else<br>
-    {<br>
-        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy() => err = %i (%s)", __PRETTY_FUNCTION__, err, strerror(err));<br>
-        assert(err == 0);<br>
-    }<br>
-    memset (&m_mutex, '\xba', sizeof(m_mutex));<br>
-#else<br>
-    ::pthread_mutex_destroy (&m_mutex);<br>
-#endif<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Locks the mutex owned by this object, if the mutex is already<br>
-// locked, the calling thread will block until the mutex becomes<br>
-// available.<br>
-//<br>
-// RETURNS<br>
-//  The error code from the pthread_mutex_lock() function call.<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Mutex::Lock()<br>
-{<br>
-    DEBUG_LOG ("[%4.4" PRIx64 "/%4.4" PRIx64 "] pthread_mutex_lock (%p)...\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), &m_mutex);<br>
-<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    error_check_mutex (&m_mutex, eMutexActionAssertInitialized);<br>
-#endif<br>
-<br>
-    int err = ::pthread_mutex_lock (&m_mutex);<br>
-<br>
-<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    if (err)<br>
-    {<br>
-        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_lock(%p) => err = %i (%s)", __PRETTY_FUNCTION__, &m_mutex, err, strerror(err));<br>
-        assert(err == 0);<br>
-    }<br>
-#endif<br>
-    DEBUG_LOG ("[%4.4" PRIx64 "/%4.4" PRIx64 "] pthread_mutex_lock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), &m_mutex, err);<br>
-    return err;<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Attempts to lock the mutex owned by this object without blocking.<br>
-// If the mutex is already locked, TryLock() will not block waiting<br>
-// for the mutex, but will return an error condition.<br>
-//<br>
-// RETURNS<br>
-//  The error code from the pthread_mutex_trylock() function call.<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Mutex::TryLock(const char *failure_message)<br>
-{<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    error_check_mutex (&m_mutex, eMutexActionAssertInitialized);<br>
-#endif<br>
-<br>
-    int err = ::pthread_mutex_trylock (&m_mutex);<br>
-    DEBUG_LOG ("[%4.4" PRIx64 "/%4.4" PRIx64 "] pthread_mutex_trylock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), &m_mutex, err);<br>
-    return err;<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// If the current thread holds the lock on the owned mutex, then<br>
-// Unlock() will unlock the mutex. Calling Unlock() on this object<br>
-// that the calling thread does not hold will result in undefined<br>
-// behavior.<br>
-//<br>
-// RETURNS<br>
-//  The error code from the pthread_mutex_unlock() function call.<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Mutex::Unlock()<br>
-{<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    error_check_mutex (&m_mutex, eMutexActionAssertInitialized);<br>
-#endif<br>
-<br>
-    int err = ::pthread_mutex_unlock (&m_mutex);<br>
-<br>
-#if ENABLE_MUTEX_ERROR_CHECKING<br>
-    if (err)<br>
-    {<br>
-        Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_unlock(%p) => err = %i (%s)", __PRETTY_FUNCTION__, &m_mutex, err, strerror(err));<br>
-        assert(err == 0);<br>
-    }<br>
-#endif<br>
-    DEBUG_LOG ("[%4.4" PRIx64 "/%4.4" PRIx64 "] pthread_mutex_unlock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), &m_mutex, err);<br>
-    return err;<br>
-}<br>
-<br>
-#endif<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Mutex get accessor.<br>
-//----------------------------------------------------------------------<br>
-lldb::mutex_t *<br>
-Mutex::GetMutex()<br>
-{<br>
-    return &m_mutex;<br>
-}<br>
-<br>
-#ifdef LLDB_CONFIGURATION_DEBUG<br>
-int<br>
-TrackingMutex::Unlock ()<br>
-{<br>
-    if (!m_failure_message.empty())<br>
-        Host::SetCrashDescriptionWithFormat ("Unlocking lock (on thread %p) that thread: %p failed to get: %s",<br>
-                                             pthread_self(),<br>
-                                             m_thread_that_tried,<br>
-                                             m_failure_message.c_str());<br>
-    assert (m_failure_message.empty());<br>
-    return Mutex::Unlock();<br>
-}<br>
-<br>
-int<br>
-LoggingMutex::Lock ()<br>
-{<br>
-    printf("locking mutex %p by [%4.4" PRIx64 "/%4.4" PRIx64 "]...", this, Host::GetCurrentProcessID(), Host::GetCurrentThreadID());<br>
-    int x = Mutex::Lock();<br>
-    m_locked = true;<br>
-    printf("%d\n",x);<br>
-    return x;<br>
-}<br>
-<br>
-int<br>
-LoggingMutex::Unlock ()<br>
-{<br>
-    printf("unlocking mutex %p by [%4.4" PRIx64 "/%4.4" PRIx64 "]...", this, Host::GetCurrentProcessID(), Host::GetCurrentThreadID());<br>
-    int x = Mutex::Unlock();<br>
-    m_locked = false;<br>
-    printf("%d\n",x);<br>
-    return x;<br>
-}<br>
-<br>
-int<br>
-LoggingMutex::TryLock (const char *failure_message)<br>
-{<br>
-    printf("trylocking mutex %p by [%4.4" PRIx64 "/%4.4" PRIx64 "]...", this, Host::GetCurrentProcessID(), Host::GetCurrentThreadID());<br>
-    int x = Mutex::TryLock(failure_message);<br>
-    if (x == 0)<br>
-        m_locked = true;<br>
-    printf("%d\n",x);<br>
-    return x;<br>
-}<br>
-<br>
-#endif<br>
-<br>
-<br>
<br>
Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)<br>
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Thu Jul 28 12:32:20 2016<br>
@@ -877,11 +877,7 @@ ConnectionFileDescriptor::GetListeningPo<br>
     if (timeout_sec == UINT32_MAX)<br>
         m_port_predicate.WaitForValueNotEqualTo(0, bound_port);<br>
     else<br>
-    {<br>
-        TimeValue timeout = TimeValue::Now();<br>
-        timeout.OffsetWithSeconds(timeout_sec);<br>
-        m_port_predicate.WaitForValueNotEqualTo(0, bound_port, &timeout);<br>
-    }<br>
+        m_port_predicate.WaitForValueNotEqualTo(0, bound_port, std::chrono::seconds(timeout_sec));<br>
     return bound_port;<br>
 }<br>
<br>
<br>
Removed: lldb/trunk/source/Host/windows/Condition.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Condition.cpp?rev=277010&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Condition.cpp?rev=277010&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/windows/Condition.cpp (original)<br>
+++ lldb/trunk/source/Host/windows/Condition.cpp (removed)<br>
@@ -1,98 +0,0 @@<br>
-//===-- Condition.cpp -------------------------------------------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include <errno.h><br>
-<br>
-#include "lldb/Host/Condition.h"<br>
-#include "lldb/Host/TimeValue.h"<br>
-#include "lldb/Host/windows/windows.h"<br>
-<br>
-<br>
-using namespace lldb_private;<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor<br>
-//<br>
-// The default constructor will initialize a new pthread condition<br>
-// and maintain the condition in the object state.<br>
-//----------------------------------------------------------------------<br>
-Condition::Condition () :<br>
-    m_condition()<br>
-{<br>
-    m_condition = static_cast<PCONDITION_VARIABLE>(malloc(sizeof(CONDITION_VARIABLE)));<br>
-    InitializeConditionVariable(static_cast<PCONDITION_VARIABLE>(m_condition));<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Destructor<br>
-//<br>
-// Destroys the pthread condition that the object owns.<br>
-//----------------------------------------------------------------------<br>
-Condition::~Condition ()<br>
-{<br>
-    free(m_condition);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Unblock all threads waiting for a condition variable<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Condition::Broadcast ()<br>
-{<br>
-    WakeAllConditionVariable(static_cast<PCONDITION_VARIABLE>(m_condition));<br>
-    return 0;<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Unblocks one thread waiting for the condition variable<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Condition::Signal ()<br>
-{<br>
-    WakeConditionVariable(static_cast<PCONDITION_VARIABLE>(m_condition));<br>
-    return 0;<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// The Wait() function atomically blocks the current thread<br>
-// waiting on the owned condition variable, and unblocks the mutex<br>
-// specified by "mutex".  The waiting thread unblocks only after<br>
-// another thread calls Signal(), or Broadcast() with the same<br>
-// condition variable, or if "abstime" is valid (non-NULL) this<br>
-// function will return when the system time reaches the time<br>
-// specified in "abstime". If "abstime" is NULL this function will<br>
-// wait for an infinite amount of time for the condition variable<br>
-// to be signaled or broadcasted.<br>
-//<br>
-// The current thread re-acquires the lock on "mutex".<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Condition::Wait (Mutex &mutex, const TimeValue *abstime, bool *timed_out)<br>
-{<br>
-    DWORD wait = INFINITE;<br>
-    if (abstime != NULL) {<br>
-        int wval = (*abstime - TimeValue::Now()) / 1000000;<br>
-        if (wval < 0) wval = 0;<br>
-<br>
-        wait = wval;<br>
-    }<br>
-<br>
-    int err = SleepConditionVariableCS(static_cast<PCONDITION_VARIABLE>(m_condition), static_cast<PCRITICAL_SECTION>(mutex.m_mutex), wait);<br>
-<br>
-    if (timed_out != NULL)<br>
-    {<br>
-        if ((err == 0) && GetLastError() == ERROR_TIMEOUT)<br>
-            *timed_out = true;<br>
-        else<br>
-            *timed_out = false;<br>
-    }<br>
-<br>
-    return err == 0;<br>
-}<br>
-<br>
<br>
Removed: lldb/trunk/source/Host/windows/Mutex.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Mutex.cpp?rev=277010&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Mutex.cpp?rev=277010&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Host/windows/Mutex.cpp (original)<br>
+++ lldb/trunk/source/Host/windows/Mutex.cpp (removed)<br>
@@ -1,109 +0,0 @@<br>
-//===-- Mutex.cpp -----------------------------------------------*- C++ -*-===//<br>
-//<br>
-//                     The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "lldb/Host/Mutex.h"<br>
-#include "lldb/Host/Host.h"<br>
-#include "lldb/Host/windows/windows.h"<br>
-<br>
-#include <string.h><br>
-#include <stdio.h><br>
-<br>
-#if 0<br>
-// This logging is way too verbose to enable even for a log channel.<br>
-// This logging can be enabled by changing the "#if 0", but should be<br>
-// reverted prior to checking in.<br>
-#include <cstdio><br>
-#define DEBUG_LOG(fmt, ...) printf(fmt, ## __VA_ARGS__)<br>
-#else<br>
-#define DEBUG_LOG(fmt, ...)<br>
-#endif<br>
-<br>
-using namespace lldb_private;<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor.<br>
-//<br>
-// Creates a pthread mutex with no attributes.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Mutex () :<br>
-    m_mutex()<br>
-{<br>
-    m_mutex = static_cast<PCRITICAL_SECTION>(malloc(sizeof(CRITICAL_SECTION)));<br>
-    InitializeCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Default constructor.<br>
-//<br>
-// Creates a pthread mutex with "type" as the mutex type.<br>
-//----------------------------------------------------------------------<br>
-Mutex::Mutex (Mutex::Type type) :<br>
-    m_mutex()<br>
-{<br>
-    m_mutex = static_cast<PCRITICAL_SECTION>(malloc(sizeof(CRITICAL_SECTION)));<br>
-    InitializeCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Destructor.<br>
-//<br>
-// Destroys the mutex owned by this object.<br>
-//----------------------------------------------------------------------<br>
-Mutex::~Mutex()<br>
-{<br>
-    DeleteCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));<br>
-    free(m_mutex);<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Locks the mutex owned by this object, if the mutex is already<br>
-// locked, the calling thread will block until the mutex becomes<br>
-// available.<br>
-//<br>
-// RETURNS<br>
-//  The error code from the pthread_mutex_lock() function call.<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Mutex::Lock()<br>
-{<br>
-    DEBUG_LOG ("[%4.4" PRIx64 "/%4.4" PRIx64 "] pthread_mutex_lock (%p)...\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), m_mutex);<br>
-<br>
-    EnterCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));<br>
-    return 0;<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// Attempts to lock the mutex owned by this object without blocking.<br>
-// If the mutex is already locked, TryLock() will not block waiting<br>
-// for the mutex, but will return an error condition.<br>
-//<br>
-// RETURNS<br>
-//  The error code from the pthread_mutex_trylock() function call.<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Mutex::TryLock(const char *failure_message)<br>
-{<br>
-    return TryEnterCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex)) == 0;<br>
-}<br>
-<br>
-//----------------------------------------------------------------------<br>
-// If the current thread holds the lock on the owned mutex, then<br>
-// Unlock() will unlock the mutex. Calling Unlock() on this object<br>
-// that the calling thread does not hold will result in undefined<br>
-// behavior.<br>
-//<br>
-// RETURNS<br>
-//  The error code from the pthread_mutex_unlock() function call.<br>
-//----------------------------------------------------------------------<br>
-int<br>
-Mutex::Unlock()<br>
-{<br>
-    LeaveCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));<br>
-    return 0;<br>
-}<br>
<br>
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h (original)<br>
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h Thu Jul 28 12:32:20 2016<br>
@@ -22,7 +22,6 @@<br>
 #include "lldb/Host/FileSpec.h"<br>
 #include "lldb/Core/StructuredData.h"<br>
 #include "lldb/Core/UUID.h"<br>
-#include "lldb/Host/Mutex.h"<br>
 #include "lldb/Target/Process.h"<br>
 #include "lldb/Utility/SafeMachO.h"<br>
<br>
<br>
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Thu Jul 28 12:32:20 2016<br>
@@ -699,7 +699,8 @@ PlatformLinux::DebugProcess (ProcessLaun<br>
         // Handle the hijacking of process events.<br>
         if (listener_sp)<br>
         {<br>
-            const StateType state = process_sp->WaitForProcessToStop (NULL, NULL, false, listener_sp);<br>
+            const StateType state =<br>
+                process_sp->WaitForProcessToStop(std::chrono::microseconds(0), NULL, false, listener_sp);<br>
<br>
             if (state == eStateStopped)<br>
             {<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Thu Jul 28 12:32:20 2016<br>
@@ -210,11 +210,10 @@ CommunicationKDP::GetSequenceMutex(std::<br>
     return (lock = std::unique_lock<std::recursive_mutex>(m_sequence_mutex, std::try_to_lock)).owns_lock();<br>
 }<br>
<br>
-<br>
 bool<br>
-CommunicationKDP::WaitForNotRunningPrivate (const TimeValue *timeout_ptr)<br>
+CommunicationKDP::WaitForNotRunningPrivate(const std::chrono::microseconds &timeout)<br>
 {<br>
-    return m_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);<br>
+    return m_is_running.WaitForValueEqualTo(false, timoeut, NULL);<br>
 }<br>
<br>
 size_t<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h Thu Jul 28 12:32:20 2016<br>
@@ -249,7 +249,7 @@ protected:<br>
                                                 uint32_t timeout_usec);<br>
<br>
     bool<br>
-    WaitForNotRunningPrivate (const lldb_private::TimeValue *timeout_ptr);<br>
+    WaitForNotRunningPrivate(const std::chrono::microseconds &timeout);<br>
<br>
     void<br>
     MakeRequestPacketHeader (CommandType request_type,<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Jul 28 12:32:20 2016<br>
@@ -941,7 +941,7 @@ ProcessKDP::AsyncThread (void *arg)<br>
             if (log)<br>
                 log->Printf ("ProcessKDP::AsyncThread (pid = %" PRIu64 ") listener.WaitForEvent (NULL, event_sp)...",<br>
                              pid);<br>
-            if (listener_sp->WaitForEvent (NULL, event_sp))<br>
+            if (listener_sp->WaitForEvent(stsd::chrono::micrseconds(0), event_sp))<br>
             {<br>
                 uint32_t event_type = event_sp->GetType();<br>
                 if (log)<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Jul 28 12:32:20 2016<br>
@@ -152,23 +152,22 @@ GDBRemoteCommunication::History::Dump (L<br>
 //----------------------------------------------------------------------<br>
 // GDBRemoteCommunication constructor<br>
 //----------------------------------------------------------------------<br>
-GDBRemoteCommunication::GDBRemoteCommunication(const char *comm_name,<br>
-                                               const char *listener_name) :<br>
-    Communication(comm_name),<br>
+GDBRemoteCommunication::GDBRemoteCommunication(const char *comm_name, const char *listener_name)<br>
+    : Communication(comm_name),<br>
 #ifdef LLDB_CONFIGURATION_DEBUG<br>
-    m_packet_timeout (1000),<br>
+      m_packet_timeout(1000),<br>
 #else<br>
-    m_packet_timeout (1),<br>
+      m_packet_timeout(1),<br>
 #endif<br>
-    m_echo_number(0),<br>
-    m_supports_qEcho (eLazyBoolCalculate),<br>
-    m_sequence_mutex (Mutex::eMutexTypeRecursive),<br>
-    m_public_is_running (false),<br>
-    m_private_is_running (false),<br>
-    m_history (512),<br>
-    m_send_acks (true),<br>
-    m_compression_type (CompressionType::None),<br>
-    m_listen_url ()<br>
+      m_echo_number(0),<br>
+      m_supports_qEcho(eLazyBoolCalculate),<br>
+      m_sequence_mutex(),<br>
+      m_public_is_running(false),<br>
+      m_private_is_running(false),<br>
+      m_history(512),<br>
+      m_send_acks(true),<br>
+      m_compression_type(CompressionType::None),<br>
+      m_listen_url()<br>
 {<br>
 }<br>
<br>
@@ -229,7 +228,7 @@ GDBRemoteCommunication::SendNack ()<br>
 GDBRemoteCommunication::PacketResult<br>
 GDBRemoteCommunication::SendPacket (const char *payload, size_t payload_length)<br>
 {<br>
-    Mutex::Locker locker(m_sequence_mutex);<br>
+    std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);<br>
     return SendPacketNoLock (payload, payload_length);<br>
 }<br>
<br>
@@ -323,20 +322,19 @@ GDBRemoteCommunication::GetAck ()<br>
 }<br>
<br>
 bool<br>
-GDBRemoteCommunication::GetSequenceMutex (Mutex::Locker& locker, const char *failure_message)<br>
+GDBRemoteCommunication::GetSequenceMutex(std::unique_lock<std::recursive_mutex> &lock, const char *failure_message)<br>
 {<br>
     if (IsRunning())<br>
-        return locker.TryLock (m_sequence_mutex, failure_message);<br>
+        return (lock = std::unique_lock<std::recursive_mutex>(m_sequence_mutex, std::try_to_lock)).owns_lock();<br>
<br>
-    locker.Lock (m_sequence_mutex);<br>
+    lock = std::unique_lock<std::recursive_mutex>(m_sequence_mutex);<br>
     return true;<br>
 }<br>
<br>
-<br>
 bool<br>
-GDBRemoteCommunication::WaitForNotRunningPrivate (const TimeValue *timeout_ptr)<br>
+GDBRemoteCommunication::WaitForNotRunningPrivate(const std::chrono::microseconds &timeout)<br>
 {<br>
-    return m_private_is_running.WaitForValueEqualTo (false, timeout_ptr, NULL);<br>
+    return m_private_is_running.WaitForValueEqualTo(false, timeout, NULL);<br>
 }<br>
<br>
 GDBRemoteCommunication::PacketResult<br>
@@ -356,20 +354,22 @@ GDBRemoteCommunication::ReadPacket (Stri<br>
 GDBRemoteCommunication::PacketResult<br>
 GDBRemoteCommunication::PopPacketFromQueue (StringExtractorGDBRemote &response, uint32_t timeout_usec)<br>
 {<br>
-    // Calculate absolute timeout value<br>
-    TimeValue timeout = TimeValue::Now();<br>
-    timeout.OffsetWithMicroSeconds(timeout_usec);<br>
+    auto until = std::chrono::system_clock::now() + std::chrono::microseconds(timeout_usec);<br>
<br>
-    do<br>
+    while (true)<br>
     {<br>
         // scope for the mutex<br>
         {<br>
             // lock down the packet queue<br>
-            Mutex::Locker locker(m_packet_queue_mutex);<br>
+            std::unique_lock<std::mutex> lock(m_packet_queue_mutex);<br>
<br>
             // Wait on condition variable.<br>
             if (m_packet_queue.size() == 0)<br>
-                m_condition_queue_not_empty.Wait(m_packet_queue_mutex, &timeout);<br>
+            {<br>
+                std::cv_status result = m_condition_queue_not_empty.wait_until(lock, until);<br>
+                if (result == std::cv_status::timeout)<br>
+                  break;<br>
+            }<br>
<br>
             if (m_packet_queue.size() > 0)<br>
             {<br>
@@ -389,7 +389,7 @@ GDBRemoteCommunication::PopPacketFromQue<br>
              return PacketResult::ErrorDisconnected;<br>
<br>
       // Loop while not timed out<br>
-    } while (TimeValue::Now() < timeout);<br>
+    }<br>
<br>
     return PacketResult::ErrorReplyTimeout;<br>
 }<br>
@@ -1479,12 +1479,11 @@ void GDBRemoteCommunication::AppendBytes<br>
             // scope for the mutex<br>
             {<br>
                 // lock down the packet queue<br>
-                Mutex::Locker locker(m_packet_queue_mutex);<br>
+                std::lock_guard<std::mutex> guard(m_packet_queue_mutex);<br>
                 // push a new packet into the queue<br>
                 m_packet_queue.push(packet);<br>
                 // Signal condition variable that we have a packet<br>
-                m_condition_queue_not_empty.Signal();<br>
-<br>
+                m_condition_queue_not_empty.notify_one();<br>
             }<br>
         }<br>
<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Thu Jul 28 12:32:20 2016<br>
@@ -12,6 +12,8 @@<br>
<br>
 // C Includes<br>
 // C++ Includes<br>
+#include <condition_variable><br>
+#include <mutex><br>
 #include <string><br>
 #include <queue><br>
 #include <vector><br>
@@ -22,7 +24,6 @@<br>
 #include "lldb/Core/Communication.h"<br>
 #include "lldb/Core/Listener.h"<br>
 #include "lldb/Host/HostThread.h"<br>
-#include "lldb/Host/Mutex.h"<br>
 #include "lldb/Host/Predicate.h"<br>
 #include "lldb/Host/TimeValue.h"<br>
 #include "lldb/Interpreter/Args.h"<br>
@@ -114,7 +115,7 @@ public:<br>
                         size_t payload_length);<br>
<br>
     bool<br>
-    GetSequenceMutex(Mutex::Locker& locker, const char *failure_message = nullptr);<br>
+    GetSequenceMutex(std::unique_lock<std::recursive_mutex> &lock, const char *failure_message = nullptr);<br>
<br>
     PacketType<br>
     CheckForPacket (const uint8_t *src,<br>
@@ -285,9 +286,9 @@ protected:<br>
     uint32_t m_echo_number;<br>
     LazyBool m_supports_qEcho;<br>
 #ifdef ENABLE_MUTEX_ERROR_CHECKING<br>
-    TrackingMutex m_sequence_mutex;<br>
+#error TrackingMutex is no longer supported<br>
 #else<br>
-    Mutex m_sequence_mutex;    // Restrict access to sending/receiving packets to a single thread at a time<br>
+    std::recursive_mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time<br>
 #endif<br>
     Predicate<bool> m_public_is_running;<br>
     Predicate<bool> m_private_is_running;<br>
@@ -320,7 +321,7 @@ protected:<br>
                                                 bool sync_on_timeout);<br>
<br>
     bool<br>
-    WaitForNotRunningPrivate (const TimeValue *timeout_ptr);<br>
+    WaitForNotRunningPrivate(const std::chrono::microseconds &timeout);<br>
<br>
     bool<br>
     CompressionIsEnabled ()<br>
@@ -364,8 +365,8 @@ protected:<br>
<br>
 private:<br>
     std::queue<StringExtractorGDBRemote> m_packet_queue; // The packet queue<br>
-    lldb_private::Mutex m_packet_queue_mutex;            // Mutex for accessing queue<br>
-    Condition m_condition_queue_not_empty;               // Condition variable to wait for packets<br>
+    std::mutex m_packet_queue_mutex;                     // Mutex for accessing queue<br>
+    std::condition_variable m_condition_queue_not_empty; // Condition variable to wait for packets<br>
<br>
     HostThread m_listen_thread;<br>
     std::string m_listen_url;<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Jul 28 12:32:20 2016<br>
@@ -720,9 +720,10 @@ GDBRemoteCommunicationClient::SendPacket<br>
     std::string &response_string<br>
 )<br>
 {<br>
-    Mutex::Locker locker;<br>
-    if (!GetSequenceMutex(locker,<br>
-                          "ProcessGDBRemote::SendPacketsAndConcatenateResponses() failed due to not getting the sequence mutex"))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (!GetSequenceMutex(<br>
+            lock,<br>
+            "ProcessGDBRemote::SendPacketsAndConcatenateResponses() failed due to not getting the sequence mutex"))<br>
     {<br>
         Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS));<br>
         if (log)<br>
@@ -821,7 +822,7 @@ GDBRemoteCommunicationClient::SendPacket<br>
 )<br>
 {<br>
     PacketResult packet_result = PacketResult::ErrorSendFailed;<br>
-    Mutex::Locker locker;<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
     Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));<br>
<br>
     // In order to stop async notifications from being processed in the middle of the<br>
@@ -829,7 +830,7 @@ GDBRemoteCommunicationClient::SendPacket<br>
     static ListenerSP hijack_listener_sp(Listener::MakeListener("lldb.NotifyHijacker"));<br>
     HijackBroadcaster(hijack_listener_sp, eBroadcastBitGdbReadThreadGotNotify);<br>
<br>
-    if (GetSequenceMutex (locker))<br>
+    if (GetSequenceMutex(lock))<br>
     {<br>
         packet_result = SendPacketAndWaitForResponseNoLock (payload, payload_length, response);<br>
     }<br>
@@ -848,19 +849,22 @@ GDBRemoteCommunicationClient::SendPacket<br>
                     log->Printf ("async: async packet = %s", m_async_packet.c_str());<br>
<br>
                 bool timed_out = false;<br>
-                if (SendInterrupt(locker, 2, timed_out))<br>
+                if (SendInterrupt(lock, 2, timed_out))<br>
                 {<br>
                     if (m_interrupt_sent)<br>
                     {<br>
                         m_interrupt_sent = false;<br>
-                        TimeValue timeout_time;<br>
-                        timeout_time = TimeValue::Now();<br>
-                        timeout_time.OffsetWithSeconds (m_packet_timeout);<br>
+<br>
+                        std::chrono::time_point<std::chrono::system_clock> until;<br>
+                        until = std::chrono::system_clock::now() + std::chrono::seconds(m_packet_timeout);<br>
<br>
                         if (log)<br>
                             log->Printf ("async: sent interrupt");<br>
<br>
-                        if (m_async_packet_predicate.WaitForValueEqualTo (false, &timeout_time, &timed_out))<br>
+                        if (m_async_packet_predicate.WaitForValueEqualTo(<br>
+                                false, std::chrono::duration_cast<std::chrono::microseconds>(<br>
+                                           until - std::chrono::system_clock::now()),<br>
+                                &timed_out))<br>
                         {<br>
                             if (log)<br>
                                 log->Printf ("async: got response");<br>
@@ -876,7 +880,10 @@ GDBRemoteCommunicationClient::SendPacket<br>
                         }<br>
<br>
                         // Make sure we wait until the continue packet has been sent again...<br>
-                        if (m_private_is_running.WaitForValueEqualTo (true, &timeout_time, &timed_out))<br>
+                        if (m_private_is_running.WaitForValueEqualTo(<br>
+                                true, std::chrono::duration_cast<std::chrono::microseconds>(<br>
+                                          until - std::chrono::system_clock::now()),<br>
+                                &timed_out))<br>
                         {<br>
                             if (log)<br>
                             {<br>
@@ -1045,7 +1052,7 @@ GDBRemoteCommunicationClient::SendvContP<br>
         log->Printf("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);<br>
<br>
     // we want to lock down packet sending while we continue<br>
-    Mutex::Locker locker(m_sequence_mutex);<br>
+    std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);<br>
<br>
     // here we broadcast this before we even send the packet!!<br>
     // this signals doContinue() to exit<br>
@@ -1094,7 +1101,7 @@ GDBRemoteCommunicationClient::SendContin<br>
     if (log)<br>
         log->Printf ("GDBRemoteCommunicationClient::%s ()", __FUNCTION__);<br>
<br>
-    Mutex::Locker locker(m_sequence_mutex);<br>
+    std::lock_guard<std::recursive_mutex> guard(m_sequence_mutex);<br>
     StateType state = eStateRunning;<br>
<br>
     m_public_is_running.SetValue (true, eBroadcastNever);<br>
@@ -1394,8 +1401,8 @@ GDBRemoteCommunicationClient::SendAsyncS<br>
     std::lock_guard<std::recursive_mutex> guard(m_async_mutex);<br>
     m_async_signal = signo;<br>
     bool timed_out = false;<br>
-    Mutex::Locker locker;<br>
-    if (SendInterrupt (locker, 1, timed_out))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (SendInterrupt(lock, 1, timed_out))<br>
         return true;<br>
     m_async_signal = -1;<br>
     return false;<br>
@@ -1412,12 +1419,8 @@ GDBRemoteCommunicationClient::SendAsyncS<br>
 // (gdb remote protocol requires this), and do what we need to do, then resume.<br>
<br>
 bool<br>
-GDBRemoteCommunicationClient::SendInterrupt<br>
-(<br>
-    Mutex::Locker& locker,<br>
-    uint32_t seconds_to_wait_for_stop,<br>
-    bool &timed_out<br>
-)<br>
+GDBRemoteCommunicationClient::SendInterrupt(std::unique_lock<std::recursive_mutex> &lock,<br>
+                                            uint32_t seconds_to_wait_for_stop, bool &timed_out)<br>
 {<br>
     timed_out = false;<br>
     Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS));<br>
@@ -1425,7 +1428,7 @@ GDBRemoteCommunicationClient::SendInterr<br>
     if (IsRunning())<br>
     {<br>
         // Only send an interrupt if our debugserver is running...<br>
-        if (GetSequenceMutex (locker))<br>
+        if (GetSequenceMutex(lock))<br>
         {<br>
             if (log)<br>
                 log->Printf ("SendInterrupt () - got sequence mutex without having to interrupt");<br>
@@ -1444,13 +1447,8 @@ GDBRemoteCommunicationClient::SendInterr<br>
                 m_interrupt_sent = true;<br>
                 if (seconds_to_wait_for_stop)<br>
                 {<br>
-                    TimeValue timeout;<br>
-                    if (seconds_to_wait_for_stop)<br>
-                    {<br>
-                        timeout = TimeValue::Now();<br>
-                        timeout.OffsetWithSeconds (seconds_to_wait_for_stop);<br>
-                    }<br>
-                    if (m_private_is_running.WaitForValueEqualTo (false, &timeout, &timed_out))<br>
+                    if (m_private_is_running.WaitForValueEqualTo(false, std::chrono::seconds(seconds_to_wait_for_stop),<br>
+                                                                 &timed_out))<br>
                     {<br>
                         if (log)<br>
                             log->PutCString ("SendInterrupt () - sent interrupt, private state stopped");<br>
@@ -3653,10 +3651,10 @@ size_t<br>
 GDBRemoteCommunicationClient::GetCurrentThreadIDs (std::vector<lldb::tid_t> &thread_ids,<br>
                                                    bool &sequence_mutex_unavailable)<br>
 {<br>
-    Mutex::Locker locker;<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
     thread_ids.clear();<br>
-<br>
-    if (GetSequenceMutex (locker, "ProcessGDBRemote::UpdateThreadList() failed due to not getting the sequence mutex"))<br>
+<br>
+    if (GetSequenceMutex(lock, "ProcessGDBRemote::UpdateThreadList() failed due to not getting the sequence mutex"))<br>
     {<br>
         sequence_mutex_unavailable = false;<br>
         StringExtractorGDBRemote response;<br>
@@ -4203,8 +4201,8 @@ GDBRemoteCommunicationClient::AvoidGPack<br>
 bool<br>
 GDBRemoteCommunicationClient::ReadRegister(lldb::tid_t tid, uint32_t reg, StringExtractorGDBRemote &response)<br>
 {<br>
-    Mutex::Locker locker;<br>
-    if (GetSequenceMutex (locker, "Didn't get sequence mutex for p packet."))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (GetSequenceMutex(lock, "Didn't get sequence mutex for p packet."))<br>
     {<br>
         const bool thread_suffix_supported = GetThreadSuffixSupported();<br>
<br>
@@ -4228,8 +4226,8 @@ GDBRemoteCommunicationClient::ReadRegist<br>
 bool<br>
 GDBRemoteCommunicationClient::ReadAllRegisters (lldb::tid_t tid, StringExtractorGDBRemote &response)<br>
 {<br>
-    Mutex::Locker locker;<br>
-    if (GetSequenceMutex (locker, "Didn't get sequence mutex for g packet."))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (GetSequenceMutex(lock, "Didn't get sequence mutex for g packet."))<br>
     {<br>
         const bool thread_suffix_supported = GetThreadSuffixSupported();<br>
<br>
@@ -4256,8 +4254,8 @@ GDBRemoteCommunicationClient::SaveRegist<br>
         return false;<br>
<br>
     m_supports_QSaveRegisterState = eLazyBoolYes;<br>
-    Mutex::Locker locker;<br>
-    if (GetSequenceMutex (locker, "Didn't get sequence mutex for QSaveRegisterState."))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (GetSequenceMutex(lock, "Didn't get sequence mutex for QSaveRegisterState."))<br>
     {<br>
         const bool thread_suffix_supported = GetThreadSuffixSupported();<br>
         if (thread_suffix_supported || SetCurrentThread(tid))<br>
@@ -4298,9 +4296,9 @@ GDBRemoteCommunicationClient::RestoreReg<br>
     // order to be useful<br>
     if (m_supports_QSaveRegisterState == eLazyBoolNo)<br>
         return false;<br>
-<br>
-    Mutex::Locker locker;<br>
-    if (GetSequenceMutex (locker, "Didn't get sequence mutex for QRestoreRegisterState."))<br>
+<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (GetSequenceMutex(lock, "Didn't get sequence mutex for QRestoreRegisterState."))<br>
     {<br>
         const bool thread_suffix_supported = GetThreadSuffixSupported();<br>
         if (thread_suffix_supported || SetCurrentThread(tid))<br>
@@ -4530,8 +4528,10 @@ GDBRemoteCommunicationClient::ServeSymbo<br>
<br>
     if (m_supports_qSymbol && m_qSymbol_requests_done == false)<br>
     {<br>
-        Mutex::Locker locker;<br>
-        if (GetSequenceMutex(locker, "GDBRemoteCommunicationClient::ServeSymbolLookups() failed due to not getting the sequence mutex"))<br>
+        std::unique_lock<std::recursive_mutex> lock;<br>
+        if (GetSequenceMutex(<br>
+                lock,<br>
+                "GDBRemoteCommunicationClient::ServeSymbolLookups() failed due to not getting the sequence mutex"))<br>
         {<br>
             StreamString packet;<br>
             packet.PutCString ("qSymbol::");<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Thu Jul 28 12:32:20 2016<br>
@@ -105,9 +105,7 @@ public:<br>
     SendAsyncSignal (int signo);<br>
<br>
     bool<br>
-    SendInterrupt (Mutex::Locker &locker,<br>
-                   uint32_t seconds_to_wait_for_stop,<br>
-                   bool &timed_out);<br>
+    SendInterrupt(std::unique_lock<std::recursive_mutex> &lock, uint32_t seconds_to_wait_for_stop, bool &timed_out);<br>
<br>
     lldb::pid_t<br>
     GetCurrentProcessID (bool allow_lazy = true);<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Thu Jul 28 12:32:20 2016<br>
@@ -401,8 +401,8 @@ GDBRemoteRegisterContext::WriteRegisterB<br>
                                   reg_info->byte_size,          // dst length<br>
                                   m_reg_data.GetByteOrder()))   // dst byte order<br>
     {<br>
-        Mutex::Locker locker;<br>
-        if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for write register."))<br>
+        std::unique_lock<std::recursive_mutex> lock;<br>
+        if (gdb_comm.GetSequenceMutex(lock, "Didn't get sequence mutex for write register."))<br>
         {<br>
             const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported();<br>
             ProcessSP process_sp (m_thread.GetProcess());<br>
@@ -570,8 +570,8 @@ GDBRemoteRegisterContext::ReadAllRegiste<br>
<br>
     const bool use_g_packet = gdb_comm.AvoidGPackets ((ProcessGDBRemote *)process) == false;<br>
<br>
-    Mutex::Locker locker;<br>
-    if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for read all registers."))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (gdb_comm.GetSequenceMutex(lock, "Didn't get sequence mutex for read all registers."))<br>
     {<br>
         SyncThreadState(process);<br>
<br>
@@ -679,8 +679,8 @@ GDBRemoteRegisterContext::WriteAllRegist<br>
     const bool use_g_packet = gdb_comm.AvoidGPackets ((ProcessGDBRemote *)process) == false;<br>
<br>
     StringExtractorGDBRemote response;<br>
-    Mutex::Locker locker;<br>
-    if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for write all registers."))<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
+    if (gdb_comm.GetSequenceMutex(lock, "Didn't get sequence mutex for write all registers."))<br>
     {<br>
         const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported();<br>
         ProcessSP process_sp (m_thread.GetProcess());<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jul 28 12:32:20 2016<br>
@@ -1590,9 +1590,6 @@ ProcessGDBRemote::DoResume ()<br>
         else<br>
         {<br>
             EventSP event_sp;<br>
-            TimeValue timeout;<br>
-            timeout = TimeValue::Now();<br>
-            timeout.OffsetWithSeconds (5);<br>
             if (!m_async_thread.IsJoinable())<br>
             {<br>
                 error.SetErrorString ("Trying to resume but the async thread is dead.");<br>
@@ -1603,7 +1600,7 @@ ProcessGDBRemote::DoResume ()<br>
<br>
             m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (continue_packet.GetData(), continue_packet.GetSize()));<br>
<br>
-            if (listener_sp->WaitForEvent (&timeout, event_sp) == false)<br>
+            if (listener_sp->WaitForEvent(std::chrono::seconds(5), event_sp) == false)<br>
             {<br>
                 error.SetErrorString("Resume timed out.");<br>
                 if (log)<br>
@@ -2717,7 +2714,7 @@ ProcessGDBRemote::DoHalt (bool &caused_s<br>
     Error error;<br>
<br>
     bool timed_out = false;<br>
-    Mutex::Locker locker;<br>
+    std::unique_lock<std::recursive_mutex> lock;<br>
<br>
     if (m_public_state.GetValue() == eStateAttaching)<br>
     {<br>
@@ -2727,7 +2724,7 @@ ProcessGDBRemote::DoHalt (bool &caused_s<br>
     }<br>
     else<br>
     {<br>
-        if (!m_gdb_comm.SendInterrupt (locker, 2, timed_out))<br>
+        if (!m_gdb_comm.SendInterrupt(lock, 2, timed_out))<br>
         {<br>
             if (timed_out)<br>
                 error.SetErrorString("timed out sending interrupt packet");<br>
@@ -3860,7 +3857,7 @@ ProcessGDBRemote::AsyncThread (void *arg<br>
     {<br>
         if (log)<br>
             log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64 ") listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());<br>
-        if (process->m_async_listener_sp->WaitForEvent (NULL, event_sp))<br>
+        if (process->m_async_listener_sp->WaitForEvent(std::chrono::microseconds(0), event_sp))<br>
         {<br>
             const uint32_t event_type = event_sp->GetType();<br>
             if (event_sp->BroadcasterIs (&process->m_async_broadcaster))<br>
<br>
Modified: lldb/trunk/source/Target/Process.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Target/Process.cpp (original)<br>
+++ lldb/trunk/source/Target/Process.cpp Thu Jul 28 12:32:20 2016<br>
@@ -978,10 +978,8 @@ Process::SyncIOHandler (uint32_t iohandl<br>
     if (!m_process_input_reader)<br>
         return;<br>
<br>
-    TimeValue timeout = TimeValue::Now();<br>
-    timeout.OffsetWithMicroSeconds(timeout_msec*1000);<br>
     uint32_t new_iohandler_id = 0;<br>
-    m_iohandler_sync.WaitForValueNotEqualTo(iohandler_id, new_iohandler_id, &timeout);<br>
+    m_iohandler_sync.WaitForValueNotEqualTo(iohandler_id, new_iohandler_id, std::chrono::milliseconds(timeout_msec));<br>
<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));<br>
     if (log)<br>
@@ -989,12 +987,8 @@ Process::SyncIOHandler (uint32_t iohandl<br>
 }<br>
<br>
 StateType<br>
-Process::WaitForProcessToStop (const TimeValue *timeout,<br>
-                               EventSP *event_sp_ptr,<br>
-                               bool wait_always,<br>
-                               ListenerSP hijack_listener_sp,<br>
-                               Stream *stream,<br>
-                               bool use_run_lock)<br>
+Process::WaitForProcessToStop(const std::chrono::microseconds &timeout, EventSP *event_sp_ptr, bool wait_always,<br>
+                              ListenerSP hijack_listener_sp, Stream *stream, bool use_run_lock)<br>
 {<br>
     // We can't just wait for a "stopped" event, because the stopped event may have restarted the target.<br>
     // We have to actually check each event, and in the case of a stopped event check the restarted flag<br>
@@ -1009,8 +1003,7 @@ Process::WaitForProcessToStop (const Tim<br>
<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));<br>
     if (log)<br>
-        log->Printf ("Process::%s (timeout = %p)", __FUNCTION__,<br>
-                     static_cast<const void*>(timeout));<br>
+        log->Printf("Process::%s (timeout = %llu)", __FUNCTION__, static_cast<unsigned long long>(timeout.count()));<br>
<br>
     if (!wait_always &&<br>
         StateIsStoppedState(state, true) &&<br>
@@ -1029,7 +1022,7 @@ Process::WaitForProcessToStop (const Tim<br>
     while (state != eStateInvalid)<br>
     {<br>
         EventSP event_sp;<br>
-        state = WaitForStateChangedEvents (timeout, event_sp, hijack_listener_sp);<br>
+        state = WaitForStateChangedEvents(std::chrono::milliseconds(0), event_sp, hijack_listener_sp);<br>
         if (event_sp_ptr && event_sp)<br>
             *event_sp_ptr = event_sp;<br>
<br>
@@ -1265,8 +1258,7 @@ Process::HandleProcessStateChangedEvent<br>
 }<br>
<br>
 StateType<br>
-Process::WaitForState(const TimeValue *timeout,<br>
-                      const StateType *match_states,<br>
+Process::WaitForState(const std::chrono::microseconds &timeout, const StateType *match_states,<br>
                       const uint32_t num_match_states)<br>
 {<br>
     EventSP event_sp;<br>
@@ -1307,13 +1299,14 @@ Process::RestoreProcessEvents ()<br>
 }<br>
<br>
 StateType<br>
-Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp, ListenerSP hijack_listener_sp)<br>
+Process::WaitForStateChangedEvents(const std::chrono::microseconds &timeout, EventSP &event_sp,<br>
+                                   ListenerSP hijack_listener_sp)<br>
 {<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));<br>
<br>
     if (log)<br>
-        log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__,<br>
-                     static_cast<const void*>(timeout));<br>
+        log->Printf("Process::%s (timeout = %llu, event_sp)...", __FUNCTION__,<br>
+                    static_cast<unsigned long long>(timeout.count()));<br>
<br>
     ListenerSP listener_sp = hijack_listener_sp;<br>
     if (!listener_sp)<br>
@@ -1332,9 +1325,8 @@ Process::WaitForStateChangedEvents (cons<br>
     }<br>
<br>
     if (log)<br>
-        log->Printf ("Process::%s (timeout = %p, event_sp) => %s",<br>
-                     __FUNCTION__, static_cast<const void*>(timeout),<br>
-                     StateAsCString(state));<br>
+        log->Printf("Process::%s (timeout = %llu, event_sp) => %s", __FUNCTION__,<br>
+                    static_cast<unsigned long long>(timeout.count()), StateAsCString(state));<br>
     return state;<br>
 }<br>
<br>
@@ -1367,13 +1359,13 @@ Process::PeekAtStateChangedEvents ()<br>
 }<br>
<br>
 StateType<br>
-Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &event_sp)<br>
+Process::WaitForStateChangedEventsPrivate(const std::chrono::microseconds &timeout, EventSP &event_sp)<br>
 {<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));<br>
<br>
     if (log)<br>
-        log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__,<br>
-                     static_cast<const void*>(timeout));<br>
+        log->Printf("Process::%s (timeout = %llu, event_sp)...", __FUNCTION__,<br>
+                    static_cast<unsigned long long>(timeout.count()));<br>
<br>
     StateType state = eStateInvalid;<br>
     if (m_private_state_listener_sp->WaitForEventForBroadcasterWithType (timeout,<br>
@@ -1387,20 +1379,20 @@ Process::WaitForStateChangedEventsPrivat<br>
     // to the command-line, and that could disable the log, which would render the<br>
     // log we got above invalid.<br>
     if (log)<br>
-        log->Printf ("Process::%s (timeout = %p, event_sp) => %s",<br>
-                     __FUNCTION__, static_cast<const void *>(timeout),<br>
-                     state == eStateInvalid ? "TIMEOUT" : StateAsCString(state));<br>
+        log->Printf("Process::%s (timeout = %llu, event_sp) => %s", __FUNCTION__,<br>
+                    static_cast<unsigned long long>(timeout.count()),<br>
+                    state == eStateInvalid ? "TIMEOUT" : StateAsCString(state));<br>
     return state;<br>
 }<br>
<br>
 bool<br>
-Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool control_only)<br>
+Process::WaitForEventsPrivate(const std::chrono::microseconds &timeout, EventSP &event_sp, bool control_only)<br>
 {<br>
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));<br>
<br>
     if (log)<br>
-        log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__,<br>
-                     static_cast<const void*>(timeout));<br>
+        log->Printf("Process::%s (timeout = %llu, event_sp)...", __FUNCTION__,<br>
+                    static_cast<unsigned long long>(timeout.count()));<br>
<br>
     if (control_only)<br>
         return m_private_state_listener_sp->WaitForEventForBroadcaster(timeout, &m_private_state_control_broadcaster, event_sp);<br>
@@ -1751,7 +1743,7 @@ Process::ResumeSynchronous (Stream *stre<br>
     Error error = PrivateResume();<br>
     if (error.Success())<br>
     {<br>
-        StateType state = WaitForProcessToStop (NULL, NULL, true, listener_sp, stream);<br>
+        StateType state = WaitForProcessToStop(std::chrono::microseconds(0), NULL, true, listener_sp, stream);<br>
         const bool must_be_alive = false; // eStateExited is ok, so this must be false<br>
         if (!StateIsStoppedState(state, must_be_alive))<br>
             error.SetErrorStringWithFormat("process not in stopped state after synchronous resume: %s", StateAsCString(state));<br>
@@ -2891,7 +2883,7 @@ Process::DisableWatchpoint (Watchpoint *<br>
 }<br>
<br>
 StateType<br>
-Process::WaitForProcessStopPrivate (const TimeValue *timeout, EventSP &event_sp)<br>
+Process::WaitForProcessStopPrivate(const std::chrono::microseconds &timeout, EventSP &event_sp)<br>
 {<br>
     StateType state;<br>
     // Now wait for the process to launch and return control to us, and then<br>
@@ -2987,10 +2979,7 @@ Process::Launch (ProcessLaunchInfo &laun<br>
                 else<br>
                 {<br>
                     EventSP event_sp;<br>
-                    TimeValue timeout_time;<br>
-                    timeout_time = TimeValue::Now();<br>
-                    timeout_time.OffsetWithSeconds(10);<br>
-                    StateType state = WaitForProcessStopPrivate(&timeout_time, event_sp);<br>
+                    StateType state = WaitForProcessStopPrivate(std::chrono::seconds(10), event_sp);<br>
<br>
                     if (state == eStateInvalid || !event_sp)<br>
                     {<br>
@@ -3083,7 +3072,7 @@ Process::LoadCore ()<br>
<br>
         // Wait indefinitely for a stopped event since we just posted one above...<br>
         lldb::EventSP event_sp;<br>
-        listener_sp->WaitForEvent (nullptr, event_sp);<br>
+        listener_sp->WaitForEvent(std::chrono::microseconds(0), event_sp);<br>
         StateType state = ProcessEventData::GetStateFromEvent(event_sp.get());<br>
<br>
         if (!StateIsStoppedState (state, false))<br>
@@ -3502,8 +3491,8 @@ Process::ConnectRemote (Stream *strm, co<br>
         if (GetID() != LLDB_INVALID_PROCESS_ID)<br>
         {<br>
             EventSP event_sp;<br>
-            StateType state = WaitForProcessStopPrivate(nullptr, event_sp);<br>
-<br>
+            StateType state = WaitForProcessStopPrivate(std::chrono::microseconds(0), event_sp);<br>
+<br>
             if (state == eStateStopped || state == eStateCrashed)<br>
             {<br>
                 // If we attached and actually have a process on the other end, then<br>
@@ -3612,11 +3601,8 @@ Process::Halt (bool clear_thread_plans,<br>
     }<br>
<br>
     // Wait for 10 second for the process to stop.<br>
-    TimeValue timeout_time;<br>
-    timeout_time = TimeValue::Now();<br>
-    timeout_time.OffsetWithSeconds(10);<br>
-    StateType state = WaitForProcessToStop(&timeout_time, &event_sp, true, halt_listener_sp,<br>
-                                           nullptr, use_run_lock);<br>
+    StateType state =<br>
+        WaitForProcessToStop(std::chrono::seconds(10), &event_sp, true, halt_listener_sp, nullptr, use_run_lock);<br>
     RestoreProcessEvents();<br>
<br>
     if (state == eStateInvalid || ! event_sp)<br>
@@ -3649,10 +3635,7 @@ Process::StopForDestroyOrDetach(lldb::Ev<br>
         SendAsyncInterrupt();<br>
<br>
         // Consume the interrupt event.<br>
-        TimeValue timeout (TimeValue::Now());<br>
-        timeout.OffsetWithSeconds(10);<br>
-<br>
-        StateType state = WaitForProcessToStop (&timeout, &exit_event_sp, true, listener_sp);<br>
+        StateType state = WaitForProcessToStop(std::chrono::seconds(10), &exit_event_sp, true, listener_sp);<br>
<br>
         RestoreProcessEvents();<br>
<br>
@@ -4125,12 +4108,9 @@ Process::ControlPrivateStateThread (uint<br>
             while (!receipt_received)<br>
             {<br>
                 bool timed_out = false;<br>
-                TimeValue timeout_time;<br>
-                timeout_time = TimeValue::Now();<br>
-                timeout_time.OffsetWithSeconds(2);<br>
                 // Check for a receipt for 2 seconds and then check if the private state<br>
                 // thread is still around.<br>
-                receipt_received = event_receipt_sp->WaitForEventReceived (&timeout_time, &timed_out);<br>
+                receipt_received = event_receipt_sp->WaitForEventReceived(std::chrono::seconds(2), &timed_out);<br>
                 if (!receipt_received)<br>
                 {<br>
                     // Check if the private state thread is still around. If it isn't then we are done waiting<br>
@@ -4326,7 +4306,7 @@ Process::RunPrivateStateThread (bool is_<br>
     while (!exit_now)<br>
     {<br>
         EventSP event_sp;<br>
-        WaitForEventsPrivate(nullptr, event_sp, control_only);<br>
+        WaitForEventsPrivate(std::chrono::microseconds(0), event_sp, control_only);<br>
         if (event_sp->BroadcasterIs(&m_private_state_control_broadcaster))<br>
         {<br>
             if (log)<br>
@@ -5351,9 +5331,6 @@ Process::RunThreadPlan(ExecutionContext<br>
         lldb::EventSP event_sp;<br>
         lldb::StateType stop_state = lldb::eStateInvalid;<br>
<br>
-        TimeValue* timeout_ptr = nullptr;<br>
-        TimeValue real_timeout;<br>
-<br>
         bool before_first_timeout = true;  // This is set to false the first time that we have to halt the target.<br>
         bool do_resume = true;<br>
         bool handle_running_event = true;<br>
@@ -5454,6 +5431,7 @@ Process::RunThreadPlan(ExecutionContext<br>
 #endif<br>
         TimeValue one_thread_timeout;<br>
         TimeValue final_timeout;<br>
+        std::chrono::microseconds timeout = std::chrono::microseconds(0);<br>
<br>
         while (true)<br>
         {<br>
@@ -5484,10 +5462,7 @@ Process::RunThreadPlan(ExecutionContext<br>
                     }<br>
                 }<br>
<br>
-                TimeValue resume_timeout = TimeValue::Now();<br>
-                resume_timeout.OffsetWithMicroSeconds(500000);<br>
-<br>
-                got_event = listener_sp->WaitForEvent(&resume_timeout, event_sp);<br>
+                got_event = listener_sp->WaitForEvent(std::chrono::microseconds(500000), event_sp);<br>
                 if (!got_event)<br>
                 {<br>
                     if (log)<br>
@@ -5552,33 +5527,16 @@ Process::RunThreadPlan(ExecutionContext<br>
             if (before_first_timeout)<br>
             {<br>
                 if (options.GetTryAllThreads())<br>
-                {<br>
-                    one_thread_timeout = TimeValue::Now();<br>
-                    one_thread_timeout.OffsetWithMicroSeconds(one_thread_timeout_usec);<br>
-                    timeout_ptr = &one_thread_timeout;<br>
-                }<br>
+                    timeout = std::chrono::microseconds(one_thread_timeout_usec);<br>
                 else<br>
-                {<br>
-                    if (timeout_usec == 0)<br>
-                        timeout_ptr = nullptr;<br>
-                    else<br>
-                    {<br>
-                        final_timeout = TimeValue::Now();<br>
-                        final_timeout.OffsetWithMicroSeconds (timeout_usec);<br>
-                        timeout_ptr = &final_timeout;<br>
-                    }<br>
-                }<br>
+                    timeout = std::chrono::microseconds(timeout_usec);<br>
             }<br>
             else<br>
             {<br>
                 if (timeout_usec == 0)<br>
-                    timeout_ptr = nullptr;<br>
+                    timeout = std::chrono::microseconds(0);<br>
                 else<br>
-                {<br>
-                    final_timeout = TimeValue::Now();<br>
-                    final_timeout.OffsetWithMicroSeconds (all_threads_timeout_usec);<br>
-                    timeout_ptr = &final_timeout;<br>
-                }<br>
+                    timeout = std::chrono::microseconds(all_threads_timeout_usec);<br>
             }<br>
<br>
             do_resume = true;<br>
@@ -5589,11 +5547,15 @@ Process::RunThreadPlan(ExecutionContext<br>
<br>
             if (log)<br>
             {<br>
-                if (timeout_ptr)<br>
+                if (timeout.count())<br>
                 {<br>
-                    log->Printf ("Process::RunThreadPlan(): about to wait - now is %" PRIu64 " - endpoint is %" PRIu64,<br>
-                                 TimeValue::Now().GetAsMicroSecondsSinceJan1_1970(),<br>
-                                 timeout_ptr->GetAsMicroSecondsSinceJan1_1970());<br>
+                    log->Printf(<br>
+                        "Process::RunThreadPlan(): about to wait - now is %llu - endpoint is %llu",<br>
+                        static_cast<unsigned long long>(std::chrono::system_clock::now().time_since_epoch().count()),<br>
+                        static_cast<unsigned long long>(<br>
+                            std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>(timeout)<br>
+                                .time_since_epoch()<br>
+                                .count()));<br>
                 }<br>
                 else<br>
                 {<br>
@@ -5611,7 +5573,7 @@ Process::RunThreadPlan(ExecutionContext<br>
             }<br>
             else<br>
 #endif<br>
-            got_event = listener_sp->WaitForEvent (timeout_ptr, event_sp);<br>
+                got_event = listener_sp->WaitForEvent(timeout, event_sp);<br>
<br>
             if (got_event)<br>
             {<br>
@@ -5810,10 +5772,7 @@ Process::RunThreadPlan(ExecutionContext<br>
                         if (log)<br>
                             log->PutCString ("Process::RunThreadPlan(): Halt succeeded.");<br>
<br>
-                        real_timeout = TimeValue::Now();<br>
-                        real_timeout.OffsetWithMicroSeconds(500000);<br>
-<br>
-                        got_event = listener_sp->WaitForEvent(&real_timeout, event_sp);<br>
+                        got_event = listener_sp->WaitForEvent(std::chrono::microseconds(500000), event_sp);<br>
<br>
                         if (got_event)<br>
                         {<br>
<br>
Modified: lldb/trunk/source/Target/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=277011&r1=277010&r2=277011&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=277011&r1=277010&r2=277011&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Target/Target.cpp (original)<br>
+++ lldb/trunk/source/Target/Target.cpp Thu Jul 28 12:32:20 2016<br>
@@ -3103,8 +3103,9 @@ Target::Launch (ProcessLaunchInfo &launc<br>
                 m_process_sp->HijackProcessEvents(hijack_listener_sp);<br>
             }<br>
<br>
-            StateType state = m_process_sp->WaitForProcessToStop(nullptr, nullptr, false, hijack_listener_sp, nullptr);<br>
-<br>
+            StateType state = m_process_sp->WaitForProcessToStop(std::chrono::microseconds(0), nullptr, false,<br>
+                                                                 hijack_listener_sp, nullptr);<br>
+<br>
             if (state == eStateStopped)<br>
             {<br>
                 if (!launch_info.GetFlags().Test(eLaunchFlagStopAtEntry))<br>
@@ -3114,7 +3115,8 @@ Target::Launch (ProcessLaunchInfo &launc<br>
                         error = m_process_sp->PrivateResume();<br>
                         if (error.Success())<br>
                         {<br>
-                            state = m_process_sp->WaitForProcessToStop(nullptr, nullptr, true, hijack_listener_sp, stream);<br>
+                            state = m_process_sp->WaitForProcessToStop(std::chrono::microseconds(0), nullptr, true,<br>
+                                                                       hijack_listener_sp, stream);<br>
                             const bool must_be_alive = false; // eStateExited is ok, so this must be false<br>
                             if (!StateIsStoppedState(state, must_be_alive))<br>
                             {<br>
@@ -3243,7 +3245,8 @@ Target::Attach (ProcessAttachInfo &attac<br>
         }<br>
         else<br>
         {<br>
-            state = process_sp->WaitForProcessToStop (nullptr, nullptr, false, attach_info.GetHijackListener(), stream);<br>
+            state = process_sp->WaitForProcessToStop(std::chrono::microseconds(0), nullptr, false,<br>
+                                                     attach_info.GetHijackListener(), stream);<br>
             process_sp->RestoreProcessEvents ();<br>
<br>
             if (state != eStateStopped)<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-Todd</div></div>
</div>