run<T> method
Acquires the mutex, runs fn, then releases;
ensures release on exception.
Returns the result of fn.
Audited: 2026-06-12 11:26 EDT
Implementation
Future<T> run<T>(AsyncAction<T> fn) async {
await acquire();
try {
return await fn();
} finally {
release();
}
}