Skip to content

Commit ca55bd1

Browse files
committed
Update docs for pool argument
1 parent 6ff9ee6 commit ca55bd1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/index.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ composer require amphp/parallel-functions
2323

2424
## Configuration
2525

26-
This library doesn't allow any direct configuration. It makes direct use of the default worker pool in `amphp/parallel`, which can be configured using `Amp\Parallel\Worker\pool()` in version 0.2 of `amphp/parallel`. The default maximum number of workers is 32.
26+
The functions in this library do not require an instance of `Amp\Parallel\Worker\Pool` to be provided.
27+
When a pool instance is not provided, the default worker pool in `amphp/parallel` is used, which can be configured using `Amp\Parallel\Worker\pool()` in version 0.2 of `amphp/parallel`.
28+
The default maximum number of workers is 32.
2729

2830
## Usage
2931

@@ -53,22 +55,23 @@ $values = Promise\wait(parallelMap([1, 2, 3], function ($time) {
5355

5456
### `parallel()`
5557

56-
`Amp\ParallelFunctions\parallel(callable): callable` wraps a [`callable`](https://secure.php.net/callable), so it's executed in another thread / process on invocation.
58+
`Amp\ParallelFunctions\parallel(callable, Amp\Parallel\Worker\Pool|null): callable` wraps a [`callable`](https://secure.php.net/callable), so it's executed in another thread / process on invocation.
5759
All arguments have to be serializable.
60+
The default worker pool (the pool returned by `Amp\Parallel\Worker\pool()`) will be used unless an optional `Amp\Parallel\Worker\Pool` instance is provided.
5861

5962
Currently this function only supports a direct string as function name or instances of [`\Closure`](https://secure.php.net/Closure).
6063
Support for other [`callable`](https://secure.php.net/callable) types might be added in the future.
6164

6265
### `parallelMap()`
6366

64-
`Amp\ParallelFunctions\parallelMap(array, callable): Promise` works similar to [`array_map()`](https://secure.php.net/array_map), but has a different signature.
67+
`Amp\ParallelFunctions\parallelMap(array, callable, Amp\Parallel\Worker\Pool|null): Promise` works similar to [`array_map()`](https://secure.php.net/array_map), but has a different signature.
6568
It accepts only one array instead of being variadic.
6669
It's thereby consistent with [`parallelFilter()`](#parallelfilter).
6770

6871
Restrictions of [`Amp\ParallelFunctions\parallel()`](#parallel) apply.
6972

7073
### `parallelFilter()`
7174

72-
`Amp\ParallelFunctions\parallelFilter(array, callable, int): Promise` works like [`array_filter()`](https://secure.php.net/array_filter), but returns a promise and executes in parallel.
75+
`Amp\ParallelFunctions\parallelFilter(array, callable, int, Amp\Parallel\Worker\Pool|null): Promise` works like [`array_filter()`](https://secure.php.net/array_filter), but returns a promise and executes in parallel.
7376

7477
Restrictions of [`Amp\ParallelFunctions\parallel()`](#parallel) apply.

0 commit comments

Comments
 (0)