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