lavva.exalushome
Version:
Library implementing communication and abstraction layers for ExalusHome system
23 lines (22 loc) • 607 B
TypeScript
type Lock = {
Release: () => void;
};
export declare class AsyncSemaphore {
initialCount: number;
private _running;
private _waiting;
constructor(initialCount: number);
private Take;
IsLocked: () => boolean;
/**
* Acquire a lock on the target resource.
* @returns a function to release the lock, it is critical that this function is called when the task is finished with the resource.
*/
AcquireAsync: () => Promise<Lock>;
Release: () => void;
/**
* Purge all waiting tasks from the Semaphore instance
*/
Purge: () => void;
}
export {};