node-worker-threads-pool
Version:
Simple worker threads pool using Node's worker_threads module. Compatible with ES6+ Promise, Async/Await.
17 lines (16 loc) • 636 B
TypeScript
import { Pool } from './pool';
import { TaskConfig } from './taskContainer';
import { TransferList } from './types';
export declare class TaskExecutor {
protected pool: Pool;
protected taskConfig: TaskConfig;
protected called: boolean;
constructor(pool: Pool);
/** Set timeout (in millisecond) to this task. */
setTimeout(t: number): this;
/**
* @see {@link https://nodejs.org/dist/latest-v14.x/docs/api/worker_threads.html#worker_threads_port_postmessage_value_transferlist transferList}
*/
setTransferList(transferList: TransferList): this;
protected runTask(param: any): Promise<any>;
}