read<T> method

Future<T> read<T>(
  1. Future<T> action()
)

Runs action under a shared read lock, releasing it afterward even if action throws. Multiple reads run concurrently. Audited: 2026-06-12 11:26 EDT

Implementation

Future<T> read<T>(Future<T> Function() action) async {
  await _acquireRead();
  try {
    return await action();
  } finally {
    _releaseRead();
  }
}