You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
`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.
57
59
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.
58
61
59
62
Currently this function only supports a direct string as function name or instances of [`\Closure`](https://secure.php.net/Closure).
60
63
Support for other [`callable`](https://secure.php.net/callable) types might be added in the future.
61
64
62
65
### `parallelMap()`
63
66
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.
65
68
It accepts only one array instead of being variadic.
66
69
It's thereby consistent with [`parallelFilter()`](#parallelfilter).
67
70
68
71
Restrictions of [`Amp\ParallelFunctions\parallel()`](#parallel) apply.
69
72
70
73
### `parallelFilter()`
71
74
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.
73
76
74
77
Restrictions of [`Amp\ParallelFunctions\parallel()`](#parallel) apply.
0 commit comments