ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: svn commit: r590990 - /ant/core/trunk/src/main/org/apache/tools/ant/util/WorkerAnt.java
Date Fri, 02 Nov 2007 11:24:27 GMT
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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message