API reference / @evolu/common / Task / Semaphore

Interface: Semaphore

Defined in: packages/common/src/Task.ts:555

A semaphore that limits the number of concurrent async Tasks.

For mutual exclusion (limiting to exactly one Task), consider using Mutex instead.

See

createSemaphore to create a semaphore instance.

Extends

  • Disposable

Properties

PropertyModifierTypeDescriptionDefined in
withPermitreadonly<T, E>(task) => Task<T, | AbortError | E>Executes a Task while holding a semaphore permit. The Task will wait until a permit is available before executing. Supports cancellation via AbortSignal - if the signal is aborted while waiting for a permit or during execution, the Task is cancelled and permits are properly released.packages/common/src/Task.ts:564

Methods

[dispose]()

Defined in: node_modules/typescript/lib/lib.esnext.disposable.d.ts:36

Returns

void

Inherited from
Disposable.[dispose]

Defined in: node_modules/@types/node/compatibility/disposable.d.ts:9

Returns

void

Inherited from
Disposable.[dispose]

Was this page helpful?