Name

sqlite3_db_mutex() — Extract a database connection mutex lock

Definition

sqlite3_mutex* sqlite3_db_mutex( sqlite3* db );
db

A database connection.

Returns

The database connection mutex lock. If the library is not in the “serialized” threading mode, a NULL pointer will be returned.

Description

This function extracts and returns a reference to the mutual exclusion lock associated with the given database connection. The SQLite library must be in the “serialized” threading mode. If it is in any other mode, this function will return NULL.

The mutex object can be used to lock the database connection for the purpose of avoiding race conditions, especially when accessing error messages or row counts that are stored as part of the database connection.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.