ILock
Defined in: packages/async/src/synchro/ilock.ts:16
Interface representing a lockable resource.
A lockable resource can be acquired and released to control access.
Properties
Section titled “Properties”locked
Section titled “locked”
readonlylocked:boolean
Defined in: packages/async/src/synchro/ilock.ts:18
Indicates whether the lock is currently held.
Methods
Section titled “Methods”lock()
Section titled “lock()”lock(
signal?):MaybePromiseLike<void>
Defined in: packages/async/src/synchro/ilock.ts:33
Acquires the lock, waiting if necessary until it is available.
Parameters
Section titled “Parameters”signal?
Section titled “signal?”AbortSignal | null
An optional AbortSignal to cancel the acquire operation.
Returns
Section titled “Returns”MaybePromiseLike<void>
A promise that resolves when the lock is acquired.
tryLock()
Section titled “tryLock()”tryLock():
MaybePromiseLike<boolean>
Defined in: packages/async/src/synchro/ilock.ts:25
Attempts to acquire the lock without waiting.
Returns
Section titled “Returns”MaybePromiseLike<boolean>
True if the lock was successfully acquired, false otherwise.
unlock()
Section titled “unlock()”unlock():
MaybePromiseLike<void>
Defined in: packages/async/src/synchro/ilock.ts:36
Releases the lock.
Returns
Section titled “Returns”MaybePromiseLike<void>