/// import { Pool } from "./pool"; import { StaticTaskExecutor } from "./task-executor"; import { CommonWorkerSettings } from "./common"; export declare type TaskFuncThis = { workerData: WorkerData; require: NodeRequire; }; export declare type TaskFunc = ((this: TaskFuncThis) => Promise) | ((this: TaskFuncThis) => ResultType) | ((this: TaskFuncThis, param: ParamType) => Promise) | ((this: TaskFuncThis, param: ParamType) => ResultType); export interface StaticPoolOptions extends CommonWorkerSettings { /** number of workers */ size: number; /** path of worker file or a worker function */ task: string | TaskFunc; /** data to pass into workers */ workerData?: WorkerData; } /** * Threads pool with static task. */ export declare class StaticPool extends Pool { constructor(opt: StaticPoolOptions); /** * Choose a idle worker to run the task * with param provided. */ exec(param?: ParamType, timeout?: number): Promise; /** * Create a task executor of this pool. * This is used to apply some advanced settings to a task. */ createExecutor(): StaticTaskExecutor; }