Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Test To See If The Library Is Threadsafe

int sqlite3_threadsafe(void);

SQLite can be compiled with or without mutexes. When the SQLITE_THREADSAFE C preprocessor macro is true, mutexes are enabled and SQLite is threadsafe. When that macro os false, the mutexes are omitted. Without the mutexes, it is not safe to use SQLite from more than one thread.

There is a measurable performance penalty for enabling mutexes. So if speed is of utmost importance, it makes sense to disable the mutexes. But for maximum safety, mutexes should be enabled. The default behavior is for mutexes to be enabled.

This interface can be used by a program to make sure that the version of SQLite that it is linking against was compiled with the desired setting of the SQLITE_THREADSAFE macro.

Invariants:

F10101 The sqlite3_threadsafe() function returns nonzero if SQLite was compiled with its mutexes enabled or zero if SQLite was compiled with mutexes disabled.

See also lists of Objects, Constants, and Functions.


This page last modified 2008/01/31 20:37:13 UTC