Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Using SQLite in Multithreaded Applications
SQLite can be compiled in single threaded mode (compile option SQLITE_THREADSAFE = 0).
In this variant, it cannot be used simultaneously from multiple threads, since there is no synchronization code at all. What for? For breakneck speed.
You can check if there is multithreading by calling sqlite3_threadsafe(): if it returns 0, then this is a single-threaded SQLite.
By default, SQLite is built with thread support (sqlite3.dll).
There are two ways to use multi-threaded SQLite: serialized and multi-thread.
Serialized(you must specify the SQLITE_OPEN_FULLMUTEX flag when opening the connection). In this mode, threads can pull SQLite calls as they please, no restrictions. But all calls block each other and are processed strictly sequentially.
Multi-thread (SQLITE_OPEN_NOMUTEX). In this mode, you cannot use the same connection from multiple threads at the same time (but different threads can use different connections at the same time). This mode is usually used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question