This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Harness.TimeoutWatcher should handly Object.wait(timeout) early return.


Hi,

Sometimes Object.wait(timeout) can return early. This seems to happen a
lot with cacao. And seems to be allowed. So we need to keep track of the
actual wait time left.

2006-07-26  Mark Wielaard  <mark@klomp.org>

    * Harness.java (TimeoutWatcher.run): Keep track of timeout wait
    time left.

Committed,

Mark
Index: Harness.java
===================================================================
RCS file: /cvs/mauve/mauve/Harness.java,v
retrieving revision 1.21
diff -u -r1.21 Harness.java
--- Harness.java	25 Jul 2006 23:11:15 -0000	1.21
+++ Harness.java	26 Jul 2006 20:14:12 -0000
@@ -742,7 +742,7 @@
     String tn = stripPrefix(testName.replace(File.separatorChar, '.'));
     String outputFromTest;
     boolean invalidTest = false;
-    int temp = -99;
+    int temp;
     
     // Restart the error stream printer if necessary
     if (restartESP)
@@ -1201,12 +1201,20 @@
           // We set loop to false here, it will get reset to true if 
           // reset() is called from the main Harness thread.
           loop = false;
-          try
-          {
-            wait(millisToWait);
-          }
-          catch (InterruptedException ie)
-          {}
+	  long start = System.currentTimeMillis();
+	  long waited = 0;
+	  while (waited < millisToWait)
+            {
+              try
+                {
+                  wait(millisToWait - waited);
+                }
+              catch (InterruptedException ie)
+                {
+                  // ignored.
+                }
+              waited = System.currentTimeMillis() - start;
+            }
         }
       if (shouldContinue)
         {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]