import { Semaphore } from "./Semaphore"; import { IDataHook } from "model-react"; /** * A semaphore that can be watched for unlocks, representing resources that could be locked. */ export declare class Resource { protected semaphore: Semaphore; protected name?: string; /** * Creates a new resource * @param name A name that can be used for debugging * @param concurrency The number of processes that may use the resource at a given time */ constructor(name?: string, concurrency?: number); /** * Acquires the resource once it's available * @returns The release function to unlock the resource */ acquire(): Promise<() => void>; /** * Checks whether the resource is currently locked * @param hook A hook to subscribe to changes * @returns Whether the resource is locked */ isLocked(hook?: IDataHook): boolean; /** * Releases the resource */ release(): void; } //# sourceMappingURL=Resource.d.ts.map