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

Comparing jsr166/src/main/java/util/concurrent/ForkJoinWorkerThread.java (file contents):
Revision 1.20 by dl, Sun Aug 29 23:35:07 2010 UTC vs.
Revision 1.21 by dl, Wed Sep 1 11:29:04 2010 UTC

# Line 228 | Line 228 | public class ForkJoinWorkerThread extend
228      private static final int TRIMMED     = 0x08; // killed while suspended
229  
230      /**
231 <     * Number of steals, transferred and reset in pool callbacks pool
232 <     * when idle Accessed directly by pool.
231 >     * Number of steals. Directly accessed (and reset) by
232 >     * pool.tryAccumulateStealCount when idle.
233       */
234      int stealCount;
235  
# Line 284 | Line 284 | public class ForkJoinWorkerThread extend
284  
285      /**
286       * The task currently being joined, set only when actively trying
287 <     * to helpStealer. Written only by current thread, but read by
288 <     * others.
287 >     * to help other stealers in helpJoinTask. Written only by current
288 >     * thread, but read by others.
289       */
290      private volatile ForkJoinTask<?> currentJoin;
291  
# Line 347 | Line 347 | public class ForkJoinWorkerThread extend
347      /**
348       * Initializes internal state after construction but before
349       * processing any tasks. If you override this method, you must
350 <     * invoke super.onStart() at the beginning of the method.
350 >     * invoke @code{super.onStart()} at the beginning of the method.
351       * Initialization requires care: Most fields must have legal
352       * default values, to ensure that attempted accesses from other
353       * threads work correctly even before this thread starts
# Line 445 | Line 445 | public class ForkJoinWorkerThread extend
445      }
446  
447      /**
448 <     * If a submission exists, try to activate and run it;
448 >     * If a submission exists, try to activate and run it.
449       *
450       * @return true if ran a task
451       */
452      private boolean tryExecSubmission() {
453          ForkJoinPool p = pool;
454 +        // This loop is needed in case attempt to activate fails, in
455 +        // which case we only retry if there still appears to be a
456 +        // submission.
457          while (p.hasQueuedSubmissions()) {
458              ForkJoinTask<?> t; int a;
459              if (active || // inline p.tryIncrementActiveCount
# Line 1053 | Line 1056 | public class ForkJoinWorkerThread extend
1056      }
1057  
1058      /**
1059 +     * Implements ForJoinTask.getSurplusQueuedTaskCount().
1060       * Returns an estimate of the number of tasks, offset by a
1061       * function of number of idle workers.
1062       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines