export interface FrameReorderBufferOptions {
    /**
     * Total expected frame count. The buffer is "drained" once advanceTo
     * has reached this value. waitForFrame(n) for n >= totalFrames is a
     * programming error and throws synchronously.
     */
    totalFrames: number;
}
/**
 * Coordinates parallel frame producers writing to a single in-order
 * sink. Workers call `waitForFrame(n)` (returns a promise that resolves
 * when it's their turn) and after writing call `advanceTo(n+1)` to
 * release the next waiter.
 *
 * The buffer is not thread-safe across workers in the multi-process
 * sense — both consumers and producers must run in the same Node event
 * loop. (For multi-process rendering you'd marshal frames through IPC
 * and have the parent process own the buffer.)
 */
export declare class FrameReorderBuffer {
    private nextFrame;
    private readonly waiters;
    private readonly totalFrames;
    private disposed;
    constructor(opts: FrameReorderBufferOptions);
    /**
     * Block until it's frame `n`'s turn to be written. Resolves
     * immediately if `n === nextFrame`, otherwise waits.
     *
     * Throws synchronously if `n` is out of range — we'd rather fail fast
     * on a programming error than deadlock waiting for a frame that
     * doesn't exist.
     */
    waitForFrame(n: number): Promise<void>;
    /**
     * Mark frame `n - 1` as written; release any waiter for frame `n`.
     * Idempotent — calling advanceTo(k) when nextFrame is already > k is
     * a no-op (handles the case where a worker advances past its slot).
     */
    advanceTo(n: number): void;
    /** True iff every frame has been advanced through. */
    isDrained(): boolean;
    /**
     * Cancel all pending waiters and refuse new ones. Workers awaiting
     * waitForFrame() will see their promises reject. Use on render error
     * or job cancellation so workers don't deadlock.
     */
    dispose(reason?: string): void;
}
//# sourceMappingURL=frame-reorder-buffer.d.ts.map