228 |
|
private static final int TRIMMED = 0x08; // killed while suspended |
229 |
|
|
230 |
|
/** |
231 |
< |
* Number of steals, transferred and reset in pool callbacks pool |
232 |
< |
* when idle Accessed directly by pool. |
231 |
> |
* Number of steals. Directly accessed (and reset) by |
232 |
> |
* pool.tryAccumulateStealCount when idle. |
233 |
|
*/ |
234 |
|
int stealCount; |
235 |
|
|
284 |
|
|
285 |
|
/** |
286 |
|
* The task currently being joined, set only when actively trying |
287 |
< |
* to helpStealer. Written only by current thread, but read by |
288 |
< |
* others. |
287 |
> |
* to help other stealers in helpJoinTask. Written only by current |
288 |
> |
* thread, but read by others. |
289 |
|
*/ |
290 |
|
private volatile ForkJoinTask<?> currentJoin; |
291 |
|
|
347 |
|
/** |
348 |
|
* Initializes internal state after construction but before |
349 |
|
* processing any tasks. If you override this method, you must |
350 |
< |
* invoke super.onStart() at the beginning of the method. |
350 |
> |
* invoke @code{super.onStart()} at the beginning of the method. |
351 |
|
* Initialization requires care: Most fields must have legal |
352 |
|
* default values, to ensure that attempted accesses from other |
353 |
|
* threads work correctly even before this thread starts |
445 |
|
} |
446 |
|
|
447 |
|
/** |
448 |
< |
* If a submission exists, try to activate and run it; |
448 |
> |
* If a submission exists, try to activate and run it. |
449 |
|
* |
450 |
|
* @return true if ran a task |
451 |
|
*/ |
452 |
|
private boolean tryExecSubmission() { |
453 |
|
ForkJoinPool p = pool; |
454 |
+ |
// This loop is needed in case attempt to activate fails, in |
455 |
+ |
// which case we only retry if there still appears to be a |
456 |
+ |
// submission. |
457 |
|
while (p.hasQueuedSubmissions()) { |
458 |
|
ForkJoinTask<?> t; int a; |
459 |
|
if (active || // inline p.tryIncrementActiveCount |
1056 |
|
} |
1057 |
|
|
1058 |
|
/** |
1059 |
+ |
* Implements ForJoinTask.getSurplusQueuedTaskCount(). |
1060 |
|
* Returns an estimate of the number of tasks, offset by a |
1061 |
|
* function of number of idle workers. |
1062 |
|
* |