413 |
|
* unblocked threads to the point that we know they are available) |
414 |
|
* leading to more situations requiring more threads, and so |
415 |
|
* on. This aspect of control can be seen as an (analytically |
416 |
< |
* intractible) game with an opponent that may choose the worst |
416 |
> |
* intractable) game with an opponent that may choose the worst |
417 |
|
* (for us) active thread to stall at any time. We take several |
418 |
|
* precautions to bound losses (and thus bound gains), mainly in |
419 |
|
* methods tryCompensate and awaitJoin: (1) We only try |
1399 |
|
* range). If no queue exists at the index, one is created. If |
1400 |
|
* the queue is busy, another index is randomly chosen. The |
1401 |
|
* submitMask bounds the effective number of queues to the |
1402 |
< |
* (nearest poswer of two for) parallelism level. |
1402 |
> |
* (nearest power of two for) parallelism level. |
1403 |
|
* |
1404 |
|
* @param task the task. Caller must ensure non-null. |
1405 |
|
*/ |
1757 |
|
* adds a new thread if no idle workers are available and either |
1758 |
|
* pool would become completely starved or: (at least half |
1759 |
|
* starved, and fewer than 50% spares exist, and there is at least |
1760 |
< |
* one task apparently available). Even though the availablity |
1760 |
> |
* one task apparently available). Even though the availability |
1761 |
|
* check requires a full scan, it is worthwhile in reducing false |
1762 |
|
* alarms. |
1763 |
|
* |