Skip to content

AsyncRwLock

AsyncRwLock = object

Defined in: packages/core/src/helpers/async-rw-lock.ts:28

A read-write lock for serializing async operations.

Multiple readers may hold the lock concurrently; writers are exclusive — a writer blocks until all existing readers release, and no new readers may acquire while a writer is queued or active. Waiters are served in FIFO order to prevent writer starvation.

Used by SQLite state providers to serialize write transactions (SQLite allows only one writer) while still permitting concurrent reads.

acquireRead: () => Promise<LockHandle>

Defined in: packages/core/src/helpers/async-rw-lock.ts:30

Acquire the lock in read mode. Multiple readers can hold it concurrently.

Promise<LockHandle>


acquireWrite: () => Promise<LockHandle>

Defined in: packages/core/src/helpers/async-rw-lock.ts:32

Acquire the lock in write mode. Exclusive — blocks readers and other writers.

Promise<LockHandle>