[Lldb-commits] [PATCH 3/9] Timeout if we fail to receive a state change event when destroying an inferior.
Stephen Wilson
wilsons at start.ca
Tue Jan 18 14:39:09 PST 2011
diff --git a/source/Plugins/Process/Linux/ProcessLinux.cpp b/source/Plugins/Process/Linux/ProcessLinux.cpp
index 0e8774f..ecf8479 100644
--- a/source/Plugins/Process/Linux/ProcessLinux.cpp
+++ b/source/Plugins/Process/Linux/ProcessLinux.cpp
@@ -223,20 +223,28 @@ ProcessLinux::DoDestroy()
return error;
}
- // Wait for the event to arrive. This guaranteed to be an exit event.
+ // Wait for the event to arrive. This is guaranteed to be an exit event.
StateType state;
EventSP event;
do {
- state = WaitForStateChangedEventsPrivate(NULL, event);
- } while (state != eStateExited);
+ TimeValue timeout_time;
+ timeout_time = TimeValue::Now();
+ timeout_time.OffsetWithSeconds(2);
+ state = WaitForStateChangedEventsPrivate(&timeout_time, event);
+ } while (state != eStateExited && state != eStateInvalid);
+
+ // Check if we timed out waiting for the exit event to arrive.
+ if (state == eStateInvalid)
+ error.SetErrorString("ProcessLinux::DoDestroy timed out.");
// Restart standard event handling and send the process the final kill,
// driving it out of limbo.
ResumePrivateStateThread();
}
- if (kill(m_monitor->GetPID(), SIGKILL))
+ if (kill(m_monitor->GetPID(), SIGKILL) && error.Success())
error.SetErrorToErrno();
+
return error;
}
--
1.7.3.5
More information about the lldb-commits
mailing list