diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-07-28 17:32:20 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-07-28 17:32:20 +0000 |
commit | 2d6a9ec9351f974a19eeca4c2326ef9ff701ee37 (patch) | |
tree | e306e8382919dfd8618515a84b0cf9f495868bbf /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | 5ed2b4ba1d87a8f06d7d9c5e7890d913edd44275 (diff) | |
download | bcm5719-llvm-2d6a9ec9351f974a19eeca4c2326ef9ff701ee37.tar.gz bcm5719-llvm-2d6a9ec9351f974a19eeca4c2326ef9ff701ee37.zip |
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 1cea670bd72..a14c8254041 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<std::recursive_mutex> 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)) |