/**
* @module Semaphores
*/
import type { PromiseFn, UnboundedQueue } from "./queue.js";
/**
* Describe a semaphore
*/
export type Semaphore = [...UnboundedQueue<() => void>, callback: PromiseFn<void>, remain: number];
/**
* Create a semaphore that allows n accesses
*/
export declare const init: (n: number) => Semaphore;
/**
* Wait until the semaphore allows access
*/
export declare const acquire: (s: Semaphore) => Promise<void>;
/**
* Signal to the semaphore to release access
*/
export declare const release: (s: Semaphore) => void;
/**
* Bind a task to a semaphore
*/
export declare const bind: <T extends (...args: any[]) => Promise<any>>(f: T, s: Semaphore) => T;
