import { ConcretePrimitive } from '../../types';
type MutexFn<R = any> = (didWait: boolean) => Promise<R>;
export type MutexKey = ConcretePrimitive | InstanceType<any>;
interface IMutexOptions<T> {
    key: MutexKey | MutexKey[];
    fn: MutexFn<T>;
    retryCount?: number;
    retryDelay?: number;
    renewInterval?: number;
}
export declare class MutexAcquisitionError extends Error {
    constructor(message?: string);
}
export declare function withMutex<T>(options: IMutexOptions<T>): Promise<T>;
export declare function withMutexes<T>(options: Omit<IMutexOptions<T>, 'key'> & {
    keys: IMutexOptions<T>['key'][];
}): Promise<T>;
/**
 * Helpers
 */
export declare function flattenMutexKey(key: MutexKey | MutexKey[]): string;
export {};
export declare type __ΩMutexKey = any[];
//# sourceMappingURL=mutex.d.ts.map