[Lldb-commits] [lldb] r123796 - /lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp

Stephen Wilson wilsons at start.ca
Tue Jan 18 17:30:44 PST 2011


Author: wilsons
Date: Tue Jan 18 19:30:44 2011
New Revision: 123796

URL: http://llvm.org/viewvc/llvm-project?rev=123796&view=rev
Log:
Timeout if we fail to receive a state change event when destroying an inferior.


Modified:
    lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=123796&r1=123795&r2=123796&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Tue Jan 18 19:30:44 2011
@@ -223,20 +223,28 @@
             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;
 }
 





More information about the lldb-commits mailing list