313 |
|
} |
314 |
|
|
315 |
|
/** |
316 |
< |
* Performs additional initialization and starts this thread |
316 |
> |
* Performs additional initialization and starts this thread. |
317 |
|
*/ |
318 |
|
final void start(int poolIndex, UncaughtExceptionHandler ueh) { |
319 |
|
this.poolIndex = poolIndex; |
416 |
|
// helpers for run() |
417 |
|
|
418 |
|
/** |
419 |
< |
* Find and execute tasks and check status while running |
419 |
> |
* Finds and executes tasks, and checks status while running. |
420 |
|
*/ |
421 |
|
private void mainLoop() { |
422 |
|
boolean ran = false; // true if ran a task on last step |
430 |
|
} |
431 |
|
|
432 |
|
/** |
433 |
< |
* Try to steal a task and execute it |
433 |
> |
* Tries to steal a task and execute it. |
434 |
|
* |
435 |
|
* @return true if ran a task |
436 |
|
*/ |
517 |
|
* range. This method is used only during resets and backouts. |
518 |
|
*/ |
519 |
|
private static final void writeSlot(ForkJoinTask<?>[] q, int i, |
520 |
< |
ForkJoinTask<?> t) { |
520 |
> |
ForkJoinTask<?> t) { |
521 |
|
UNSAFE.putObjectVolatile(q, (i << qShift) + qBase, t); |
522 |
|
} |
523 |
|
|
628 |
|
} |
629 |
|
|
630 |
|
/** |
631 |
< |
* Returns next task or null if empty or contended |
631 |
> |
* Returns next task, or null if empty or contended. |
632 |
|
*/ |
633 |
|
final ForkJoinTask<?> peekTask() { |
634 |
|
ForkJoinTask<?>[] q = queue; |
670 |
|
* Computes next value for random victim probe in scan(). Scans |
671 |
|
* don't require a very high quality generator, but also not a |
672 |
|
* crummy one. Marsaglia xor-shift is cheap and works well enough. |
673 |
< |
* Note: This is manually inlined in scan() |
673 |
> |
* Note: This is manually inlined in scan(). |
674 |
|
*/ |
675 |
|
private static final int xorShift(int r) { |
676 |
|
r ^= r << 13; |
776 |
|
} |
777 |
|
|
778 |
|
/** |
779 |
< |
* Sets state to TERMINATED. Called only by onTermination() |
779 |
> |
* Sets state to TERMINATED. Called only by onTermination(). |
780 |
|
*/ |
781 |
|
private void setTerminated() { |
782 |
|
int s; |