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.
| Value | Mode | Meaning |
|---|---|---|
| 0 | Single thread | Disables thread support |
| 1 | Fully serialized | Full thread support |
| 2 | Multithread | Basic 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]
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access