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.85 by dl, Sun Nov 21 13:55:04 2010 UTC vs.
Revision 1.86 by dl, Sun Nov 21 20:42:18 2010 UTC

# Line 496 | Line 496 | public class ForkJoinPool extends Abstra
496       */
497      private volatile long eventWaiters;
498  
499 <    private static final int  EVENT_COUNT_SHIFT = 32;
500 <    private static final long WAITER_ID_MASK    = (1L << 16) - 1L;
499 >    private static final int EVENT_COUNT_SHIFT = 32;
500 >    private static final int WAITER_ID_MASK    = (1 << 16) - 1;
501  
502      /**
503       * A counter for events that may wake up worker threads:
# Line 737 | Line 737 | public class ForkJoinPool extends Abstra
737          int ec = eventCount;
738          boolean releasedOne = false;
739          ForkJoinWorkerThread w; int id;
740 <        while ((id = ((int)(h & WAITER_ID_MASK)) - 1) >= 0 &&
740 >        while ((id = (((int)h) & WAITER_ID_MASK) - 1) >= 0 &&
741                 (int)(h >>> EVENT_COUNT_SHIFT) != ec &&
742                 id < n && (w = ws[id]) != null) {
743              if (UNSAFE.compareAndSwapLong(this, eventWaitersOffset,
# Line 775 | Line 775 | public class ForkJoinPool extends Abstra
775          long nh = (((long)ec) << EVENT_COUNT_SHIFT) | ((long)(w.poolIndex+1));
776          long h;
777          while ((runState < SHUTDOWN || !tryTerminate(false)) &&
778 <               (((int)((h = eventWaiters) & WAITER_ID_MASK)) == 0 ||
778 >               (((int)(h = eventWaiters) & WAITER_ID_MASK) == 0 ||
779                  (int)(h >>> EVENT_COUNT_SHIFT) == ec) &&
780                 eventCount == ec) {
781              if (UNSAFE.compareAndSwapLong(this, eventWaitersOffset,
# Line 934 | Line 934 | public class ForkJoinPool extends Abstra
934              }
935              else if ((h = eventWaiters) != 0L) {
936                  long nh;
937 <                int id = ((int)(h & WAITER_ID_MASK)) - 1;
937 >                int id = (((int)h) & WAITER_ID_MASK) - 1;
938                  if (id >= 0 && id < n && (w = ws[id]) != null &&
939                      (nh = w.nextWaiter) != 0L && // keep at least one worker
940                      UNSAFE.compareAndSwapLong(this, eventWaitersOffset, h, nh))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines