|
5 | 5 | - [Pool](#pool) |
6 | 6 | - [`pool = new FixedThreadPool(numberOfThreads, fileURL, opts)`](#pool--new-fixedthreadpoolnumberofthreads-fileurl-opts) |
7 | 7 | - [`pool = new DynamicThreadPool(min, max, fileURL, opts)`](#pool--new-dynamicthreadpoolmin-max-fileurl-opts) |
8 | | - - [`pool.execute(data, name, transferList)`](#poolexecutedata-name-transferlist) |
9 | | - - [`pool.mapExecute(data, name, transferList)`](#poolmapexecutedata-name-transferlist) |
| 8 | + - [`pool.execute(data, name, abortSignal, transferList)`](#poolexecutedata-name-abortsignal-transferlist) |
| 9 | + - [`pool.mapExecute(data, name, abortSignals, transferList)`](#poolmapexecutedata-name-abortsignals-transferlist) |
10 | 10 | - [`pool.start()`](#poolstart) |
11 | 11 | - [`pool.destroy()`](#pooldestroy) |
12 | 12 | - [`pool.hasTaskFunction(name)`](#poolhastaskfunctionname) |
@@ -41,25 +41,28 @@ override it in your worker implementation).\ |
41 | 41 | `fileURL` (mandatory) URL to a file with a worker implementation.\ |
42 | 42 | `opts` (optional) An object with the pool options properties described below. |
43 | 43 |
|
44 | | -### `pool.execute(data, name, transferList)` |
| 44 | +### `pool.execute(data, name, abortSignal, transferList)` |
45 | 45 |
|
46 | 46 | `data` (optional) An object that you want to pass to your worker task function |
47 | 47 | implementation.\ |
48 | 48 | `name` (optional) A string with the task function name that you want to execute |
49 | 49 | on the worker. Default: `'default'`\ |
| 50 | +`abortSignal` (optional) An abort signal to abort the task function execution.\ |
50 | 51 | `transferList` (optional) An array of transferable objects that you want to |
51 | 52 | transfer to your [`ThreadWorker`](#class-yourworker-extends-threadworker) |
52 | 53 | implementation. |
53 | 54 |
|
54 | 55 | This method is available on both pool implementations and returns a promise with |
55 | 56 | the task function execution response. |
56 | 57 |
|
57 | | -### `pool.mapExecute(data, name, transferList)` |
| 58 | +### `pool.mapExecute(data, name, abortSignals, transferList)` |
58 | 59 |
|
59 | | -`data` Iterable objects that you want to pass to your worker task function |
| 60 | +`data` An iterable of objects that you want to pass to your worker task function |
60 | 61 | implementation.\ |
61 | 62 | `name` (optional) A string with the task function name that you want to execute |
62 | 63 | on the worker. Default: `'default'`\ |
| 64 | +`abortSignals` (optional) An iterable of AbortSignal to abort the matching |
| 65 | +object task function execution.\ |
63 | 66 | `transferList` (optional) An array of transferable objects that you want to |
64 | 67 | transfer to your [`ThreadWorker`](#class-yourworker-extends-threadworker)) |
65 | 68 | worker implementation. |
@@ -129,7 +132,6 @@ An object with these properties: |
129 | 132 |
|
130 | 133 | - `workerChoiceStrategy` (optional) - The default worker choice strategy to use |
131 | 134 | in this pool: |
132 | | - |
133 | 135 | - `WorkerChoiceStrategies.ROUND_ROBIN`: Submit tasks to worker in a round |
134 | 136 | robin fashion |
135 | 137 | - `WorkerChoiceStrategies.LEAST_USED`: Submit tasks to the worker with the |
@@ -159,7 +161,6 @@ An object with these properties: |
159 | 161 | - `workerChoiceStrategyOptions` (optional) - The worker choice strategy options |
160 | 162 | object to use in this pool.\ |
161 | 163 | Properties: |
162 | | - |
163 | 164 | - `measurement` (optional) - The measurement to use in worker choice |
164 | 165 | strategies: `runTime`, `waitTime` <!-- or `elu`. --> |
165 | 166 | - `runTime` (optional) - Use the tasks |
@@ -195,7 +196,6 @@ An object with these properties: |
195 | 196 | - `tasksQueueOptions` (optional) - The worker tasks queue options object to use |
196 | 197 | in this pool.\ |
197 | 198 | Properties: |
198 | | - |
199 | 199 | - `size` (optional) - The maximum number of tasks that can be queued on a |
200 | 200 | worker before flagging it as back pressured. It must be a positive integer. |
201 | 201 | - `concurrency` (optional) - The maximum number of tasks that can be executed |
|
0 commit comments