@future-agi/sdk
Version:
We help GenAI teams maintain high-accuracy for their Models in production.
28 lines • 885 B
TypeScript
/**
* BoundedExecutor behaves as a ThreadPoolExecutor which will block on
* calls to submit() once the limit given as "bound" work items are queued for
* execution.
* @param bound - Integer - the maximum number of items in the work queue
* @param maxWorkers - Integer - the size of the thread pool
*/
export declare class BoundedExecutor {
private workers;
private queue;
private semaphore;
private maxWorkers;
private isShutdown;
constructor(bound: number, maxWorkers: number);
/**
* Submit a function for execution
*/
submit<T>(fn: (...args: any[]) => T | Promise<T>, ...args: any[]): Promise<T>;
/**
* Shutdown the executor
*/
shutdown(wait?: boolean): Promise<void>;
private acquireSemaphore;
private releaseSemaphore;
private startWorker;
private runWorker;
}
//# sourceMappingURL=executor.d.ts.map