Skip to content

Semaphore.acquire method

Semaphore › acquire

Takes a permit, waiting until one is free.

Signature:

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

Parameters:

ParameterTypeDescription
abortSignal?AbortSignal | undefinedCancels the wait. An aborted acquire takes no permit, so it must not be released.

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