517 |
|
if (q == null) |
518 |
|
return null; |
519 |
|
int mask = q.length - 1; |
520 |
< |
int i = locallyFifo? base : (sp - 1); |
520 |
> |
int i = locallyFifo ? base : (sp - 1); |
521 |
|
return q[i & mask]; |
522 |
|
} |
523 |
|
|
580 |
|
ForkJoinWorkerThread v = ws[mask & idx]; |
581 |
|
if (v == null || v.sp == v.base) { |
582 |
|
if (probes <= mask) |
583 |
< |
idx = (probes++ < 0)? r : (idx + 1); |
583 |
> |
idx = (probes++ < 0) ? r : (idx + 1); |
584 |
|
else |
585 |
|
break; |
586 |
|
} |
601 |
|
* @return a task, if available |
602 |
|
*/ |
603 |
|
final ForkJoinTask<?> pollTask() { |
604 |
< |
ForkJoinTask<?> t = locallyFifo? deqTask() : popTask(); |
604 |
> |
ForkJoinTask<?> t = locallyFifo ? deqTask() : popTask(); |
605 |
|
if (t == null && (t = scan()) != null) |
606 |
|
++stealCount; |
607 |
|
return t; |
613 |
|
* @return a task, if available |
614 |
|
*/ |
615 |
|
final ForkJoinTask<?> pollLocalTask() { |
616 |
< |
return locallyFifo? deqTask() : popTask(); |
616 |
> |
return locallyFifo ? deqTask() : popTask(); |
617 |
|
} |
618 |
|
|
619 |
|
/** |
693 |
|
* Returns an estimate of the number of tasks in the queue. |
694 |
|
*/ |
695 |
|
final int getQueueSize() { |
696 |
< |
int n = sp - base; |
697 |
< |
return n < 0? 0 : n; // suppress momentarily negative values |
696 |
> |
// suppress momentarily negative values |
697 |
> |
return Math.max(0, sp - base); |
698 |
|
} |
699 |
|
|
700 |
|
/** |