lock<T> method
Runs callback in a critical section.
If abortTrigger completes before the critical section was entered, an
AbortException is thrown and callback will not be invoked.
Implementation
@override
Future<T> lock<T>(
Future<T> Function() callback, {
Future<void>? abortTrigger,
}) {
return _internal.lock(() async {
final file = await _acquireFileLock();
try {
return await callback();
} finally {
await _releaseFileLock(file);
}
}, abortTrigger: abortTrigger);
}