Skip to main content

Mutex

Internal

An asynchronous mutex implementation.

This class is meant to be used in PowerSync SDKs only, and is not part of the public API.

Constructors

new Mutex()

new Mutex(): Mutex

Returns

Mutex

Methods

acquire()

acquire(abort?): Promise<UnlockFn>

Parameters

ParameterType
abort?AbortSignal

Returns

Promise<UnlockFn>


runExclusive()

runExclusive<T>(fn, abort?): Promise<T>

Type Parameters

Type Parameter
T

Parameters

ParameterType
fn() => T | PromiseLike<T>
abort?AbortSignal

Returns

Promise<T>