Name

SQLITE_THREADSAFE — Specify thread mode

Common Usage

SQLITE_THREADSAFE=<0|1|2>

Default

1 (serialized mode)

Description

Sets the default thread mode. SQLite supports three thread modes.

ValueModeMeaning
0Single threadDisables thread support
1Fully serializedFull thread support
2MultithreadBasic thread support

Single thread mode disables all mutexes and thread support. In this mode, the locking code is completely removed from the build and the mode cannot be changed. All interaction with the SQLite library must be done from a single thread.

Serialized allows a database connection to be used across multiple threads. Multithread allows the SQLite library to be used by multiple threads, but a database connection can only be used by one thread at a time.

If an application is built with thread support, it can switch between thread-safe modes (1 or 2) at application startup.

See Also

sqlite3_threadsafe() [C API, Ap G]