ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166y/ForkJoinWorkerThread.java
(Generate patch)

Comparing jsr166/src/jsr166y/ForkJoinWorkerThread.java (file contents):
Revision 1.47 by jsr166, Tue Sep 7 07:10:53 2010 UTC vs.
Revision 1.51 by jsr166, Mon Sep 20 20:42:37 2010 UTC

# Line 490 | Line 490 | public class ForkJoinWorkerThread extend
490  
491      /*
492       * Intrinsics-based atomic writes for queue slots. These are
493 <     * basically the same as methods in AtomicObjectArray, but
493 >     * basically the same as methods in AtomicReferenceArray, but
494       * specialized for (1) ForkJoinTask elements (2) requirement that
495       * nullness and bounds checks have already been performed by
496       * callers and (3) effective offsets are known not to overflow
# Line 751 | Line 751 | public class ForkJoinWorkerThread extend
751  
752      // status check methods used mainly by ForkJoinPool
753      final boolean isRunning()     { return runState == 0; }
754    final boolean isTerminating() { return (runState & TERMINATING) != 0; }
754      final boolean isTerminated()  { return (runState & TERMINATED) != 0; }
755      final boolean isSuspended()   { return (runState & SUSPENDED) != 0; }
756      final boolean isTrimmed()     { return (runState & TRIMMED) != 0; }
757  
758 +    final boolean isTerminating() {
759 +        if ((runState & TERMINATING) != 0)
760 +            return true;
761 +        if (pool.isAtLeastTerminating()) { // propagate pool state
762 +            shutdown();
763 +            return true;
764 +        }
765 +        return false;
766 +    }
767 +
768      /**
769       * Sets state to TERMINATING. Does NOT unpark or interrupt
770       * to wake up if currently blocked. Callers must do so if desired.
# Line 1057 | Line 1066 | public class ForkJoinWorkerThread extend
1066      }
1067  
1068      /**
1069 <     * Implements ForJoinTask.getSurplusQueuedTaskCount().
1069 >     * Implements ForkJoinTask.getSurplusQueuedTaskCount().
1070       * Returns an estimate of the number of tasks, offset by a
1071       * function of number of idle workers.
1072       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines