1780 |
|
|
1781 |
|
/** |
1782 |
|
* Blocks in accord with the given blocker. If the current thread |
1783 |
< |
* is a ForkJoinWorkerThread, this method possibly arranges for a |
1784 |
< |
* spare thread to be activated if necessary to ensure parallelism |
1785 |
< |
* while the current thread is blocked. If |
1786 |
< |
* {@code maintainParallelism} is {@code true} and the pool supports |
1787 |
< |
* it ({@link #getMaintainsParallelism}), this method attempts to |
1788 |
< |
* maintain the pool's nominal parallelism. Otherwise it activates |
1789 |
< |
* a thread only if necessary to avoid complete starvation. This |
1790 |
< |
* option may be preferable when blockages use timeouts, or are |
1791 |
< |
* almost always brief. |
1783 |
> |
* is a {@link ForkJoinWorkerThread}, this method possibly |
1784 |
> |
* arranges for a spare thread to be activated if necessary to |
1785 |
> |
* ensure parallelism while the current thread is blocked. |
1786 |
|
* |
1787 |
< |
* <p> If the caller is not a ForkJoinTask, this method is behaviorally |
1788 |
< |
* equivalent to |
1787 |
> |
* <p>If {@code maintainParallelism} is {@code true} and the pool |
1788 |
> |
* supports it ({@link #getMaintainsParallelism}), this method |
1789 |
> |
* attempts to maintain the pool's nominal parallelism. Otherwise |
1790 |
> |
* it activates a thread only if necessary to avoid complete |
1791 |
> |
* starvation. This option may be preferable when blockages use |
1792 |
> |
* timeouts, or are almost always brief. |
1793 |
> |
* |
1794 |
> |
* <p>If the caller is not a {@link ForkJoinTask}, this method is |
1795 |
> |
* behaviorally equivalent to |
1796 |
|
* <pre> {@code |
1797 |
|
* while (!blocker.isReleasable()) |
1798 |
|
* if (blocker.block()) |
1799 |
|
* return; |
1800 |
|
* }</pre> |
1801 |
< |
* If the caller is a ForkJoinTask, then the pool may first |
1802 |
< |
* be expanded to ensure parallelism, and later adjusted. |
1801 |
> |
* |
1802 |
> |
* If the caller is a {@code ForkJoinTask}, then the pool may |
1803 |
> |
* first be expanded to ensure parallelism, and later adjusted. |
1804 |
|
* |
1805 |
|
* @param blocker the blocker |
1806 |
|
* @param maintainParallelism if {@code true} and supported by |