X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fpool.ts;fp=src%2Fpools%2Fpool.ts;h=0df7549ace8ba8589e69fae51b3e9fd4d237736f;hb=d07983740c0d4bec954b7ec29f7f7f11e6549658;hp=c2d5498753c61a385fa43bb2a68163b305ad03a2;hpb=17dd78334af5f98262f85c011f7cf667d7306559;p=poolifier.git diff --git a/src/pools/pool.ts b/src/pools/pool.ts index c2d54987..0df7549a 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -279,13 +279,25 @@ export interface IPool< * @param data - The optional task input data for the specified task function. This can only be structured-cloneable data. * @param name - The optional name of the task function to execute. If not specified, the default task function will be executed. * @param transferList - An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards. - * @returns Promise that will be fulfilled when the task is completed. + * @returns Promise with a task function response that will be fulfilled when the task is completed. */ readonly execute: ( data?: Data, name?: string, transferList?: readonly TransferListItem[] ) => Promise + /** + * Executes the specified function in the worker constructor with the tasks data iterable input parameter. + * @param data - The tasks iterable input data for the specified task function. This can only be an iterable of structured-cloneable data. + * @param name - The optional name of the task function to execute. If not specified, the default task function will be executed. + * @param transferList - An optional array of transferable objects to transfer ownership of. Ownership of the transferred objects is given to the chosen pool's worker_threads worker and they should not be used in the main thread afterwards. + * @returns Promise with an array of task function responses that will be fulfilled when the tasks are completed. + */ + readonly mapExecute: ( + data: Iterable, + name?: string, + transferList?: readonly TransferListItem[] + ) => Promise /** * Starts the minimum number of workers in this pool. */