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.385 by dl, Fri Nov 13 15:24:36 2020 UTC vs.
Revision 1.386 by dl, Fri Nov 27 16:41:05 2020 UTC

# Line 1499 | Line 1499 | public class ForkJoinPool extends Abstra
1499              stealCount += ns;                        // accumulate steals
1500              lock.unlock();
1501              long c = ctl;
1502 <            if (w.phase != QUIET)                    // decrement counts
1502 >            if ((cfg & QUIET) == 0) // unless self-signalled, decrement counts
1503                  do {} while (c != (c = compareAndExchangeCtl(
1504                                         c, ((RC_MASK & (c - RC_UNIT)) |
1505                                             (TC_MASK & (c - TC_UNIT)) |
# Line 1659 | Line 1659 | public class ForkJoinPool extends Abstra
1659                  break;
1660              else if (mode < 0)
1661                  return -1;
1662 <            else if ((int)(ctl >> RC_SHIFT) > ac)
1662 >            else if ((c = ctl) == prevCtl)
1663                  Thread.onSpinWait();         // signal in progress
1664            else if (deadline != 0L &&
1665                     deadline - System.currentTimeMillis() <= TIMEOUT_SLOP) {
1666                if (c != (c = ctl))          // ensure consistent
1667                    ac = (int)(c >> RC_SHIFT);
1668                else if (compareAndSetCtl(c, ((UC_MASK & (c - TC_UNIT)) |
1669                                              (w.stackPred & SP_MASK)))) {
1670                    w.phase = QUIET;
1671                    return -1;               // drop on timeout
1672                }
1673            }
1664              else if (!(alt = !alt))          // check between park calls
1665                  Thread.interrupted();
1666 <            else if (deadline != 0L)
1677 <                LockSupport.parkUntil(deadline);
1678 <            else
1666 >            else if (deadline == 0L)
1667                  LockSupport.park();
1668 +            else if (deadline - System.currentTimeMillis() > TIMEOUT_SLOP)
1669 +                LockSupport.parkUntil(deadline);
1670 +            else if (((int)c & SMASK) == (w.config & SMASK) &&
1671 +                     compareAndSetCtl(c, ((UC_MASK & (c - TC_UNIT)) |
1672 +                                          (prevCtl & SP_MASK)))) {
1673 +                w.config |= QUIET;           // sentinel for deregisterWorker
1674 +                return -1;                   // drop on timeout
1675 +            }
1676 +            else if ((deadline += keepAlive) == 0L)
1677 +                deadline = 1L;               // not at head; restart timer
1678          }
1681        LockSupport.setCurrentBlocker(null);
1679          return 0;
1680      }
1681  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines