[PATCH xorg-gtest 1/4] process: reduce wait time for process termination

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 24 17:34:53 PDT 2012


Re-try with a constant 10 us until the timeout is reached instead of a
timeout-dependent wait time.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/process.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/process.cpp b/src/process.cpp
index 1a1739a..284ecbd 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -127,14 +127,14 @@ void xorg::testing::Process::Start(const std::string& program, ...) {
 }
 
 bool xorg::testing::Process::WaitForExit(unsigned int timeout) {
-  for (int i = 0; i < 10; i++) {
+  for (int i = 0; i < timeout * 100; i++) {
     int status;
     int pid = waitpid(Pid(), &status, WNOHANG);
 
     if (pid == Pid())
       return true;
 
-      usleep(timeout * 100);
+      usleep(10);
   }
 
   return false;
-- 
1.7.11.2



More information about the xorg-devel mailing list