import { Serializable, toDeserialized, toSerialized } from "../shared.js";
export declare const INTERNAL_SEMAPHORE_CONTROLLER: unique symbol;
export interface SemaphoreController {
    release(amount: number): void;
}
export declare class SemaphoreGuard implements Disposable {
    #private;
    constructor(amount: number, controller: SemaphoreController);
    get [INTERNAL_SEMAPHORE_CONTROLLER](): SemaphoreController;
    get amount(): number;
    [Symbol.dispose](): void;
    dispose(): void;
}
export declare class Semaphore extends Serializable {
    #private;
    constructor(initialCount: number, _buffer?: SharedArrayBuffer);
    get [INTERNAL_SEMAPHORE_CONTROLLER](): SemaphoreController;
    tryAcquire(amount?: number): SemaphoreGuard | null;
    blockingAcquire(amount?: number): SemaphoreGuard;
    acquire(amount?: number): Promise<SemaphoreGuard>;
    [toSerialized](): readonly [SharedArrayBuffer];
    static [toDeserialized](buffer: SharedArrayBuffer): Semaphore;
}
