acquireRead method

Future<LockGrant> acquireRead(
  1. String table, {
  2. int timeoutMs = 5000,
})

Acquire a shared (read) lock on table.

Grants immediately if: • No writer holds the lock, AND • No writer is queued (prevents writer starvation). Otherwise enqueues a read waiter in FIFO order.

Implementation

Future<LockGrant> acquireRead(String table, {int timeoutMs = 5000}) async {
  await _lockFor(table).acquireRead(timeoutMs: timeoutMs);
  return LockGrant(table, LockMode.read);
}