writeLock

abstract suspend fun <R> writeLock(callback: ThrowableLockCallback<R>): R

Takes a global lock without starting a transaction.

This lock ensures that only one write transaction can execute against the database at a time, even across separate database instances for the same file.

In most cases, writeTransaction should be used instead.

Return

The result of the callback.

Parameters

callback

The callback to execute while holding the lock.

Throws

If a database error occurs.

If the operation is cancelled.