/** * FIFO semaphore. * * Bounds the number of concurrent holders to `maxPermits`. Callers `acquire` * a slot and invoke the returned function to release it. Slots are granted * to waiters in arrival order. `Infinity` short-circuits to a no-op so * callers can disable throttling without branching at every call site. * * The release function is idempotent: calling it more than once does * nothing. This makes try/finally bookkeeping safe even if cleanup paths * overlap. * * AbortSignal: a queued `acquire` that observes its signal aborting will * remove itself from the queue and reject. A signal that aborts after * `acquire` has resolved is the caller's responsibility — they already hold * the slot and must call release. */ export interface Semaphore { acquire(signal?: AbortSignal): Promise<() => void>; /** * Synchronously claim a slot if one is available. Returns the release * function on success and null when the caller would have to queue. * Useful for emitting telemetry only when an `acquire` actually waits. */ tryAcquire(): (() => void) | null; } export declare function createSemaphore(maxPermits: number): Semaphore; //# sourceMappingURL=concurrency.d.ts.map