Martijn Kruithof wrote:

public void waitUntilFinished(long timeout) throws InterruptedException {
         synchronized(notify) {
-            if(finished) {
-                return;
+            while (!finished) {
+                notify.wait(timeout);
             }
-            notify.wait(timeout);
         }
     }
I hope you noticed that this is not an equivalent change, not just starting to accepting "false" interrupts, but also to ignore the timeout.

to do it correctly probably it should be using something using currentTimeMillis as well.

yes, I rolled it back.

the issue is, if you look at the internals of wait(), the concept of spurious wakeups, in which threads can be woken up early. They said put a while() round the test, but of course, that doesnt work in this case, as you need to extract the start time and keep going until the total test time is done. Which is just too painful to do right now. Unless I see evidence that spontaneous wakeups are real, I'm going to leave this bit alone.

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to