abortableReadLock<T> method
Future<T>
abortableReadLock<T>(})
override
Takes a read lock, without starting a transaction.
The lock only applies to a single SqliteConnection, and multiple connections may hold read locks at the same time.
If abortTrigger is set and completes before the database was able to
obtain a read lock, an AbortException will be thrown.
Implementation
@override
Future<T> abortableReadLock<T>(
Future<T> Function(SqliteReadContext tx) callback,
{Future<void>? abortTrigger,
String? debugContext}) {
final task = profileQueries ? TimelineTask() : null;
task?.start('${profilerPrefix}mutex_lock');
return mutex.lock(
() {
task?.finish();
return ScopedReadContext.assumeReadLock(
_UnsafeSyncContext(db, parent: task),
callback,
);
},
abortTrigger: abortTrigger,
);
}