@lock


Description:

public bool @lock (bSqlLockType lock_type, Cancellable? cancellable = null) throws Error

Obtains an exclusive lock on this and starts a transaction.

This should be called if you need to access this multiple times while ensuring an atomic transaction. End this transaction with @unlock.

If cancellable is specified, then this will retain a reference to it until @unlock is called. Any accesses to this with the lock held are expected to have the same cancellable specified, or null.

<note><para>Aside from ensuring atomicity of transactions, this function will hold a mutex which will cause further calls to @lock to block. If you are accessing this from multiple threads, then any interactions with this should be nested in calls to @lock and @unlock.</para></note>

Parameters:

this

An BookSqlite

lock_type

The bSqlLockType to acquire

cancellable

A Cancellable

Returns:

true on success, otherwise false is returned and throws is set appropriately.