Skip to content

Mutex.acquire method

Mutex › acquire

Takes the lock, waiting until it is free.

Signature:

acquire(abortSignal?: AbortSignal | undefined): Promise<void>

Parameters:

ParameterTypeDescription
abortSignal?AbortSignal | undefinedCancels the wait. An aborted acquire does not hold the lock, so it must not be released.

Returns: Promise<void> — A Promise that resolves once the lock is held, or rejects with the signal's reason.