From 2d6a9ec9351f974a19eeca4c2326ef9ff701ee37 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 28 Jul 2016 17:32:20 +0000 Subject: Clean up vestigial remnants of locking primitives This finally removes the use of the Mutex and Condition classes. This is an intricate patch as the Mutex and Condition classes were tied together. Furthermore, many places had slightly differing uses of time values. Convert timeout values to relative everywhere to permit the use of std::chrono::duration, which is required for the use of std::condition_variable's timeout. Adjust all Condition and related Mutex classes over to std::{,recursive_}mutex and std::condition_variable. This change primarily comes at the cost of breaking the TracingMutex which was based around the Mutex class. It would be possible to write a wrapper to provide similar functionality, but that is beyond the scope of this change. llvm-svn: 277011 --- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 1cea670..a14c825 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1590,9 +1590,6 @@ ProcessGDBRemote::DoResume () else { EventSP event_sp; - TimeValue timeout; - timeout = TimeValue::Now(); - timeout.OffsetWithSeconds (5); if (!m_async_thread.IsJoinable()) { error.SetErrorString ("Trying to resume but the async thread is dead."); @@ -1603,7 +1600,7 @@ ProcessGDBRemote::DoResume () m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (continue_packet.GetData(), continue_packet.GetSize())); - if (listener_sp->WaitForEvent (&timeout, event_sp) == false) + if (listener_sp->WaitForEvent(std::chrono::seconds(5), event_sp) == false) { error.SetErrorString("Resume timed out."); if (log) @@ -2717,7 +2714,7 @@ ProcessGDBRemote::DoHalt (bool &caused_stop) Error error; bool timed_out = false; - Mutex::Locker locker; + std::unique_lock lock; if (m_public_state.GetValue() == eStateAttaching) { @@ -2727,7 +2724,7 @@ ProcessGDBRemote::DoHalt (bool &caused_stop) } else { - if (!m_gdb_comm.SendInterrupt (locker, 2, timed_out)) + if (!m_gdb_comm.SendInterrupt(lock, 2, timed_out)) { if (timed_out) error.SetErrorString("timed out sending interrupt packet"); @@ -3860,7 +3857,7 @@ ProcessGDBRemote::AsyncThread (void *arg) { if (log) log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64 ") listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID()); - if (process->m_async_listener_sp->WaitForEvent (NULL, event_sp)) + if (process->m_async_listener_sp->WaitForEvent(std::chrono::microseconds(0), event_sp)) { const uint32_t event_type = event_sp->GetType(); if (event_sp->BroadcasterIs (&process->m_async_broadcaster)) -- cgit v1.1