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

Comparing jsr166/src/jsr166y/ForkJoinPool.java (file contents):
Revision 1.87 by dl, Tue Nov 23 00:10:39 2010 UTC vs.
Revision 1.90 by jsr166, Mon Nov 29 20:58:06 2010 UTC

# Line 728 | Line 728 | public class ForkJoinPool extends Abstra
728       * Releases workers blocked on a count not equal to current count.
729       * Normally called after precheck that eventWaiters isn't zero to
730       * avoid wasted array checks. Gives up upon a change in count or
731 <     * upon releasing two workers, letting others take over.
731 >     * upon releasing four workers, letting others take over.
732       */
733      private void releaseEventWaiters() {
734          ForkJoinWorkerThread[] ws = workers;
735          int n = ws.length;
736          long h = eventWaiters;
737          int ec = eventCount;
738 <        boolean releasedOne = false;
738 >        int releases = 4;
739          ForkJoinWorkerThread w; int id;
740          while ((id = (((int)h) & WAITER_ID_MASK) - 1) >= 0 &&
741                 (int)(h >>> EVENT_COUNT_SHIFT) != ec &&
# Line 743 | Line 743 | public class ForkJoinPool extends Abstra
743              if (UNSAFE.compareAndSwapLong(this, eventWaitersOffset,
744                                            h,  w.nextWaiter)) {
745                  LockSupport.unpark(w);
746 <                if (releasedOne) // exit on second release
746 >                if (--releases == 0)
747                      break;
748                releasedOne = true;
748              }
749              if (eventCount != ec)
750                  break;
# Line 1032 | Line 1031 | public class ForkJoinPool extends Abstra
1031       */
1032      final void awaitJoin(ForkJoinTask<?> joinMe, ForkJoinWorkerThread worker,
1033                           boolean timed, long nanos) {
1034 <        long startTime = timed? System.nanoTime() : 0L;
1034 >        long startTime = timed ? System.nanoTime() : 0L;
1035          int retries = 2 + (parallelism >> 2); // #helpJoins before blocking
1036          boolean running = true;               // false when count decremented
1037          while (joinMe.status >= 0) {
# Line 1774 | Line 1773 | public class ForkJoinPool extends Abstra
1773       * commenced but not yet completed.  This method may be useful for
1774       * debugging. A return of {@code true} reported a sufficient
1775       * period after shutdown may indicate that submitted tasks have
1776 <     * ignored or suppressed interruption, causing this executor not
1777 <     * to properly terminate.
1776 >     * ignored or suppressed interruption, or are waiting for IO,
1777 >     * causing this executor not to properly terminate. (See the
1778 >     * advisory notes for class {@link ForkJoinTask} stating that
1779 >     * tasks should not normally entail blocking operations.  But if
1780 >     * they do, they must abort them on interrupt.)
1781       *
1782       * @return {@code true} if terminating but not yet terminated
1783       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines