API reference / @evolu/common / Task / Mutex

Interface: Mutex

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

A mutex (mutual exclusion) that ensures only one Task runs at a time.

This is a specialized version of a Semaphore with a permit count of 1.

See

createMutex to create a mutex instance.

Extends

  • Disposable

Properties

PropertyModifierTypeDescriptionDefined in
withLockreadonly<T, E>(task) => Task<T, | AbortError | E>Executes a Task while holding the mutex lock. Only one Task can hold the lock at a time. Other Tasks will wait until the lock is released. Supports cancellation via AbortSignal.packages/common/src/Task.ts:701

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?