Skip to content

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.

readonly locked: boolean

Defined in: packages/async/src/synchro/ilock.ts:18

Indicates whether the lock is currently held.

lock(signal?): MaybePromiseLike<void>

Defined in: packages/async/src/synchro/ilock.ts:33

Acquires the lock, waiting if necessary until it is available.

AbortSignal | null

An optional AbortSignal to cancel the acquire operation.

MaybePromiseLike<void>

A promise that resolves when the lock is acquired.


tryLock(): MaybePromiseLike<boolean>

Defined in: packages/async/src/synchro/ilock.ts:25

Attempts to acquire the lock without waiting.

MaybePromiseLike<boolean>

True if the lock was successfully acquired, false otherwise.


unlock(): MaybePromiseLike<void>

Defined in: packages/async/src/synchro/ilock.ts:36

Releases the lock.

MaybePromiseLike<void>