[concurrency-interest] Condition.awaitNanos

David Holmes dcholmes at optusnet.com.au
Fri Mar 10 20:44:02 EST 2006


Nope that was  totally wrong sorry.

>   else if (signalled) return (x-1);
>
> The time left need only be checked if there was no signal (the
> implementation should know this). So it need only return x-1 to meet the
> spec. (That said I think we have a bug in this area with our use of
> AbstractQueuedSynchronizer as it might return a negative value after a
> signal when a small timeout is used!)

Totally wrong. You always return the time left even if signalled - this is
precisely why this method exists: in case after being signalled you still
have to wait.

In which case, I have to agree that there is a potential problem if the
elapsed time as calculated is greater than the requested timeout. You would
get a negative value, indicating a timeout even though you didn't time out.

David Holmes



More information about the Concurrency-interest mailing list