run<T> method
Acquires the mutex, runs fn, then releases;
ensures release on exception.
Returns the result of fn.
Implementation
Future<T> run<T>(AsyncAction<T> fn) async {
await acquire();
try {
return await fn();
} finally {
release();
}
}