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.128 by dl, Mon Apr 9 13:11:44 2012 UTC vs.
Revision 1.133 by jsr166, Sun Oct 21 04:14:31 2012 UTC

# Line 1047 | Line 1047 | public class ForkJoinPool extends Abstra
1047              ASHIFT = 31 - Integer.numberOfLeadingZeros(s);
1048          }
1049      }
1050 +
1051      /**
1052       * Per-thread records for threads that submit to pools. Currently
1053       * holds only pseudo-random seed / index that is used to choose
# Line 1103 | Line 1104 | public class ForkJoinPool extends Abstra
1104      private static final RuntimePermission modifyThreadPermission;
1105  
1106      /**
1107 <     * Per-thread submission bookeeping. Shared across all pools
1107 >     * Per-thread submission bookkeeping. Shared across all pools
1108       * to reduce ThreadLocal pollution and because random motion
1109       * to avoid contention in one pool is likely to hold for others.
1110       */
# Line 1307 | Line 1308 | public class ForkJoinPool extends Abstra
1308          try {
1309              WorkQueue[] ws = workQueues;
1310              if (w != null && ws != null) {          // skip on shutdown/failure
1311 <                int rs, n =  ws.length, m = n - 1;
1311 >                int rs, n = ws.length, m = n - 1;
1312                  int s = nextSeed += SEED_INCREMENT; // rarely-colliding sequence
1313                  w.seed = (s == 0) ? 1 : s;          // ensure non-zero seed
1314                  int r = (s << 1) | 1;               // use odd-numbered indices
# Line 1518 | Line 1519 | public class ForkJoinPool extends Abstra
1519       * awaiting signal,
1520       *
1521       * @param w the worker (via its WorkQueue)
1522 <     * @return a task or null of none found
1522 >     * @return a task or null if none found
1523       */
1524      private final ForkJoinTask<?> scan(WorkQueue w) {
1525          WorkQueue[] ws;                       // first update random seed
# Line 1535 | Line 1536 | public class ForkJoinPool extends Abstra
1536                      t = (ForkJoinTask<?>)U.getObjectVolatile(a, i);
1537                      if (q.base == b && ec >= 0 && t != null &&
1538                          U.compareAndSwapObject(a, i, t, null)) {
1539 <                        q.base = b + 1;       // specialization of pollAt
1539 >                        if (q.top - (q.base = b + 1) > 1)
1540 >                            signalWork();    // help pushes signal
1541                          return t;
1542                      }
1543                      else if (ec < 0 || j <= m) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines