According to http://www.sqlite.org/threadsafe.html there are three different threading modes when working with sqlite: single-threaded, multi-threaded and serialized. When configured to serialized and multi-threaded modes, mutexes are used (depending on the mode they are used more or less) and in single-threaded mode mutexes are not used at all.
Assuming that the database will only be used for queries (read-only access) is it possible to use the single-threaded mode while still accessing it from different threads? Or there are global resources that need to be protected?
In addition, can the default ADO.NET adapter System.Data.Sqlite be used in the same manner?
The SQLite library has many internal data structures that get changed even for a read-only database file (caches, compiled statements, result sets, etc.), so you must never access a single-threaded connection from multiple threads.
ADO.NET does not make any thread safety guarantees, so neither does System.Data.SQLite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With