public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: Harness.TimeoutWatcher should handly Object.wait(timeout)  early return.
@ 2006-07-26 20:19 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2006-07-26 20:19 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

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

[-- Attachment #2: Harness-timeout.patch --]
[-- Type: text/x-patch, Size: 1321 bytes --]

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)
         {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-26 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-26 20:19 FYI: Harness.TimeoutWatcher should handly Object.wait(timeout) early return Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).