Handle edge-case where resolution of System.nanoTime() can yield zero elapsed time on busy systems.

2.3.0
Brett Wooldridge 10 years ago
parent 01bebb5d35
commit 8a2e523c41

@ -126,7 +126,8 @@ public class ConcurrentBag<T extends IConcurrentBagEntry>
synchronizer.tryAcquireSharedNanos(startSeq, timeout);
timeout -= (System.nanoTime() - startScan);
final long delta = (System.nanoTime() - startScan);
timeout -= (delta > 0 ? delta : TimeUnit.MILLISECONDS.toNanos(1L));
}
while (timeout > 0L);

Loading…
Cancel
Save