ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/FutureTask.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/FutureTask.java (file contents):
Revision 1.110 by jsr166, Sun Jan 4 09:15:11 2015 UTC vs.
Revision 1.111 by jsr166, Thu Mar 5 00:32:52 2015 UTC

# Line 376 | Line 376 | public class FutureTask<V> implements Ru
376          WaitNode q = null;
377          boolean queued = false;
378          for (;;) {
379            if (Thread.interrupted()) {
380                removeWaiter(q);
381                throw new InterruptedException();
382            }
383
379              int s = state;
380              if (s > COMPLETING) {
381                  if (q != null)
382                      q.thread = null;
383                  return s;
384              }
385 <            else if (s == COMPLETING) // cannot time out yet
385 >            else if (s == COMPLETING)
386 >                // We may have already promised (via isDone) that we are done
387 >                // so never return empty-handed or throw InterruptedException
388                  Thread.yield();
389 +            else if (Thread.interrupted()) {
390 +                removeWaiter(q);
391 +                throw new InterruptedException();
392 +            }
393              else if (q == null) {
394                  if (timed && nanos <= 0L)
395                      return s;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines