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.15 by jsr166, Thu Jul 23 19:25:45 2009 UTC vs.
Revision 1.16 by jsr166, Thu Jul 23 23:07:57 2009 UTC

# Line 139 | Line 139 | public class ForkJoinWorkerThread extend
139      private static final int MAXIMUM_QUEUE_CAPACITY = 1 << 28;
140  
141      /**
142 <     * The pool this thread works in. Accessed directly by ForkJoinTask
142 >     * The pool this thread works in. Accessed directly by ForkJoinTask.
143       */
144      final ForkJoinPool pool;
145  
# Line 167 | Line 167 | public class ForkJoinWorkerThread extend
167       * Activity status. When true, this worker is considered active.
168       * Must be false upon construction. It must be true when executing
169       * tasks, and BEFORE stealing a task. It must be false before
170 <     * calling pool.sync
170 >     * calling pool.sync.
171       */
172      private boolean active;
173  
# Line 190 | Line 190 | public class ForkJoinWorkerThread extend
190  
191      /**
192       * Index of this worker in pool array. Set once by pool before
193 <     * running, and accessed directly by pool during cleanup etc
193 >     * running, and accessed directly by pool during cleanup etc.
194       */
195      int poolIndex;
196  
# Line 293 | Line 293 | public class ForkJoinWorkerThread extend
293      }
294  
295      /**
296 <     * Tries to set status to active; fails on contention.
296 >     * Tries to set status to inactive; fails on contention.
297       */
298      private boolean tryInactivate() {
299          if (active) {
# Line 371 | Line 371 | public class ForkJoinWorkerThread extend
371      /**
372       * Performs cleanup associated with termination of this worker
373       * thread.  If you override this method, you must invoke
374 <     * super.onTermination at the end of the overridden method.
374 >     * {@code super.onTermination} at the end of the overridden method.
375       *
376       * @param exception the exception causing this thread to abort due
377       * to an unrecoverable error, or null if completed normally
# Line 383 | Line 383 | public class ForkJoinWorkerThread extend
383                  ForkJoinTask<?> t = popTask();
384                  if (t != null)
385                      t.quietlyExec();
386 <            } catch(Throwable ex) {
386 >            } catch (Throwable ex) {
387                  exception = ex;
388              }
389          }
390          // Cancel other tasks, transition status, notify pool, and
391          // propagate exception to uncaught exception handler
392          try {
393 <            do;while (!tryInactivate()); // ensure inactive
393 >            do {} while (!tryInactivate()); // ensure inactive
394              cancelTasks();
395              runState = TERMINATED;
396              pool.workerTerminated(this);
# Line 671 | Line 671 | public class ForkJoinWorkerThread extend
671      /**
672       * Returns true if at least one worker in the given array appears
673       * to have at least one queued task.
674 +     *
675       * @param ws array of workers
676       */
677      static boolean hasQueuedTasks(ForkJoinWorkerThread[] ws) {
# Line 707 | Line 708 | public class ForkJoinWorkerThread extend
708      }
709  
710      /**
711 <     * Scans, returning early if joinMe done
711 >     * Scans, returning early if joinMe done.
712       */
713      final ForkJoinTask<?> scanWhileJoining(ForkJoinTask<?> joinMe) {
714          ForkJoinTask<?> t = pollTask();
# Line 719 | Line 720 | public class ForkJoinWorkerThread extend
720      }
721  
722      /**
723 <     * Runs tasks until pool isQuiescent.
723 >     * Runs tasks until {@code pool.isQuiescent()}.
724       */
725      final void helpQuiescePool() {
726          for (;;) {
# Line 729 | Line 730 | public class ForkJoinWorkerThread extend
730              else if (tryInactivate() && pool.isQuiescent())
731                  break;
732          }
733 <        do;while (!tryActivate()); // re-activate on exit
733 >        do {} while (!tryActivate()); // re-activate on exit
734      }
735  
736      // Temporary Unsafe mechanics for preliminary release

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines