@azure-tools/extension
Version:
Yarn-Based extension aquisition (for Azure Open Source Projects)
25 lines • 962 B
TypeScript
/**
* Lock using promises to await on lock.
*/
export declare class AsyncLock {
private name;
private promise;
/**
* @constructor - Creates an instance of a CriticalSection
*
* @param name - a cosmetic name for the 'resource'. Note: multiple CriticalSection instances with the same do not offer exclusivity, it's tied to the object instance.
*/
constructor(name?: string);
/**
* Asynchronously acquires the lock. Will wait for up {@link timeoutMS} milliseconds
* @throws ExclusiveLockUnavailableException - if the timeout is reached before the lock can be acquired.
* @param timeoutMS - the length of time in miliiseconds to wait for a lock.
* @returns - the release function to release the lock.
*/
acquire(timeoutMS?: number, name?: string): Promise<() => void>;
}
export interface PromiseTimeout {
promise: Promise<void>;
cancel(): void;
}
//# sourceMappingURL=async-lock.d.ts.map