Closed andersmmg closed 2 years ago
Hello @andersmmg
According to this article, the SQLite database is thread-safe if the plugin is compiled with either:
-DSQLITE_THREADSAFE=1
or (with some restrictions):
-DSQLITE_THREADSAFE=2
I don't supply this compiler parameter and thus the default value applies which is 1 (= Serialized, which allows full multi-threading without restrictions) 🥳
EDIT: One thing you should be aware of is that while SQLite ensures thread-safety, this plugin does not. In other words, you should always use different db connections (= new instances of this wrapper) on each unique thread!
Closing this issue as it has been resolved.
Feel free to open a new issue if you encounter any new and exotic problems 🙏
I update the database in a thread sometimes, so it's mutexed when I need to write to it. Currently, I don't lock the mutex when I'm just reading data, but should I? I can't seem to find a lot of documentation on this. Thanks!