///
import { ChildProcess } from 'child_process';
export declare type WeightedProcessWorker = {
weight: number;
process: ChildProcess;
};
/**
* dispatcher of workers created from `child_process.fork`
*
* only support request-response batch-by-batch
* DO NOT support multiple interlaced concurrent batches
* */
export declare class ProcessPool {
totalWeights: number;
workers: WeightedProcessWorker[];
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: WeightedProcessWorker[];
});
close(signal?: NodeJS.Signals | number): void;
}