///
import { Worker } from 'worker_threads';
export type WeightedWorker = {
weight: number;
worker: Worker;
};
/**
*
* dispatcher of workers created from `worker_threads.Worker`
*
* only support request-response batch-by-batch
* DO NOT support multiple interlaced concurrent batches
* */
export declare class ThreadPool {
totalWeights: number;
workers: WeightedWorker[];
dispatch: {
(inputs: T[], cb: (err: any, outputs: R[]) => void): void;
(inputs: T[]): Promise;
};
constructor(options: {
modulePath: string;
weights?: number[];
/**
* number of worker = (number of core / weights) * overload
* default to 1.0
* */
overload?: number;
} | {
workers: WeightedWorker[];
});
close(): void;
}