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

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.271 by jsr166, Sat Sep 12 19:38:11 2015 UTC vs.
Revision 1.272 by dl, Sun Sep 13 11:44:08 2015 UTC

# Line 840 | Line 840 | public class ForkJoinPool extends Abstra
840                  a[(al - 1) & s] = task;  // relaxed writes OK
841                  top = s + 1;
842                  ForkJoinPool p = pool;
843 <                U.storeFence();          // ensure fields written before use
843 >                U.storeFence();          // ensure fields written
844                  if ((d = b - s) == 0 && p != null)
845                      p.signalWork();
846                  else if (al + d == 1)
# Line 891 | Line 891 | public class ForkJoinPool extends Abstra
891                  if (t != null &&
892                      U.compareAndSwapObject(a, offset, t, null)) {
893                      top = s;
894                    U.storeFence();
894                      return t;
895                  }
896              }
# Line 974 | Line 973 | public class ForkJoinPool extends Abstra
973                  long offset = ((long)index << ASHIFT) + ABASE;
974                  if (U.compareAndSwapObject(a, offset, task, null)) {
975                      top = s;
977                    U.storeFence();
976                      return true;
977                  }
978              }
# Line 1179 | Line 1177 | public class ForkJoinPool extends Abstra
1177                              if (s + 1 == top) {      // pop
1178                                  if (U.compareAndSwapObject(a, offset, t, null)) {
1179                                      top = s;
1182                                    U.storeFence();
1180                                      removed = true;
1181                                  }
1182                              }
# Line 1196 | Line 1193 | public class ForkJoinPool extends Abstra
1193                          else if (t.status < 0 && s + 1 == top) {
1194                              if (U.compareAndSwapObject(a, offset, t, null)) {
1195                                  top = s;
1199                                U.storeFence();
1196                              }
1197                              break;                  // was cancelled
1198                          }
# Line 1243 | Line 1239 | public class ForkJoinPool extends Abstra
1239                              else if (U.compareAndSwapObject(a, offset,
1240                                                              t, null)) {
1241                                  top = s - 1;
1246                                U.storeFence();
1242                                  return t;
1243                              }
1244                              break;
# Line 1731 | Line 1726 | public class ForkJoinPool extends Abstra
1726       * @param r random seed
1727       */
1728      private void tryReactivate(WorkQueue w, WorkQueue[] ws, int r) {
1729 <        long c; int sp, wl, m; WorkQueue v;
1729 >        long c; int sp, wl; WorkQueue v;
1730          if ((sp = (int)(c = ctl)) != 0 && w != null &&
1731              ws != null && (wl = ws.length) > 0 &&
1732 <            ((m = wl - 1) & ((sp ^ r) >>> 16)) <= 1 &&
1733 <            (v = ws[m & sp]) != null) {
1732 >            ((sp ^ r) & SS_SEQ) == 0 &&
1733 >            (v = ws[(wl - 1) & sp]) != null) {
1734              long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + AC_UNIT));
1735              int ns = sp & ~UNSIGNALLED;
1736              if (w.scanState < 0 &&

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines