export declare class Lock { protected _callbacks: Function[]; protected _counter: number; protected _parent?: Lock; constructor(parent?: Lock, locked?: number | boolean); /** the number of times this Lock is currently locked */ get count(): number; /** the number of callbacks waiting for this Lock */ get waiting(): number; /** * Locks this lock, unlock the returned lock once you're done with this resource. * @returns a new lock */ lock(): Lock; /** Unlocks this lock. */ unlock(): Promise; /** Alias of .unlock() */ release(): Promise; /** release lock after {delay=0} ms */ release_async(delay?: number): void; /** Gets a promise which resolves when this lock is unlocked. */ get promise(): Promise; /** Will be called when the lock is unlocked. */ set callback(callback: Function); /** Waits for this lock to be unlocked, then locks. */ wait_and_lock(): Promise; /** * Attempt to lock synchronously (if not locked) * @returns a Lock upon success, does not throw on failure */ try_lock_sync(): Lock | void; /** @returns `>= 1` if lock is locked, `0` otherwise */ get locked(): number; } export default Lock;