5 |
|
*/ |
6 |
|
|
7 |
|
package jsr166y; |
8 |
+ |
|
9 |
|
import java.util.ArrayList; |
10 |
|
import java.util.Arrays; |
11 |
|
import java.util.Collection; |
180 |
|
* progress, it suffices for any in-progress poll or new push on |
181 |
|
* any empty queue to complete. |
182 |
|
* |
183 |
< |
* This approach also enables support a user mode in which local |
183 |
> |
* This approach also enables support of a user mode in which local |
184 |
|
* task processing is in FIFO, not LIFO order, simply by using |
185 |
|
* poll rather than pop. This can be useful in message-passing |
186 |
|
* frameworks in which tasks are never joined. However neither |
207 |
|
* avoid imbalance. Insertion of tasks in shared mode requires a |
208 |
|
* lock (mainly to protect in the case of resizing) but we use |
209 |
|
* only a simple spinlock (using bits in field runState), because |
210 |
< |
* submitters encountering a busy queue try others so never block. |
210 |
> |
* submitters encountering a busy queue try or create others so |
211 |
> |
* never block. |
212 |
|
* |
213 |
|
* Management. |
214 |
|
* ========== |
299 |
|
* some other queued worker rather than itself, which has the same |
300 |
|
* net effect. Because enqueued workers may actually be rescanning |
301 |
|
* rather than waiting, we set and clear the "parker" field of |
302 |
< |
* Workqueues to reduce unnecessary calls to unpark. (this |
302 |
> |
* Workqueues to reduce unnecessary calls to unpark. (This |
303 |
|
* requires a secondary recheck to avoid missed signals.) Note |
304 |
|
* the unusual conventions about Thread.interrupts surrounding |
305 |
|
* parking and other blocking: Because interrupts are used solely |
746 |
|
* be resized |
747 |
|
*/ |
748 |
|
final void push(ForkJoinTask<?> task, ForkJoinPool p) { |
747 |
– |
boolean signal = false; |
749 |
|
ForkJoinTask<?>[] a; |
750 |
|
int s = top, m, n; |
751 |
|
if ((a = array) != null) { // ignore if queue removed |
1652 |
|
} |
1653 |
|
|
1654 |
|
/** |
1655 |
< |
* Returns a non-empty steal queue, if is found during a random, |
1655 |
> |
* Returns a non-empty steal queue, if one is found during a random, |
1656 |
|
* then cyclic scan, else null. This method must be retried by |
1657 |
|
* caller if, by the time it tries to use the queue, it is empty. |
1658 |
|
*/ |
2649 |
|
} |
2650 |
|
} |
2651 |
|
} |
2652 |
+ |
|
2653 |
|
} |