Use Timeout<> in the Listener class
Summary:
Communication classes use the Timeout<> class to specify the timeout. Listener
class was converted to chrono some time ago, but it used a different meaning for
a timeout of zero (Listener: infinite wait, Communication: no wait). Instead,
Listener provided separate functions which performed a non-blocking event read.
This converts the Listener class to the new Timeout class, to improve
consistency. It also allows us to get merge the different GetNextEvent*** and
WaitForEvent*** functions into one. No functional change intended.
Reviewers: jingham, clayborg, zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D27136
llvm-svn: 288238
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 876af4f..fac5290 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1459,8 +1459,7 @@
new EventDataBytes(continue_packet.GetString().data(),
continue_packet.GetSize()));
- if (listener_sp->WaitForEvent(std::chrono::seconds(5), event_sp) ==
- false) {
+ if (listener_sp->GetEvent(event_sp, std::chrono::seconds(5)) == false) {
error.SetErrorString("Resume timed out.");
if (log)
log->Printf("ProcessGDBRemote::DoResume: Resume timed out.");
@@ -3534,8 +3533,7 @@
log->Printf("ProcessGDBRemote::%s (arg = %p, pid = %" PRIu64
") listener.WaitForEvent (NULL, event_sp)...",
__FUNCTION__, arg, process->GetID());
- if (process->m_async_listener_sp->WaitForEvent(std::chrono::microseconds(0),
- event_sp)) {
+ if (process->m_async_listener_sp->GetEvent(event_sp, llvm::None)) {
const uint32_t event_type = event_sp->GetType();
if (event_sp->BroadcasterIs(&process->m_async_broadcaster)) {
if (log)