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 && |
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; |
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 |
|
*/ |