I've just started using sqlite-net-pcl and have question related to multi-threading.
How safe is SQLiteConnection in multi-threading environment?
I've check https://www.sqlite.org/threadsafe.html documentation. From what I see the _engine_ itself has multiple modes I can rely in multi-threading environment (Multi-Thread: as user I just need to ensure to not share connection between threads (lock for single connection), Serialized: no need to care at all).
Is it any explicit way to ensure which mode I'm running?
SQLiteConnection has a lot of code around _raw_ engine. Also from what I see it keeps state (TableMappings), so is SQLiteConnection is thread safe itself?
Have a look at the doc here. You can set these flags with SQLiteOpenFlags when creating a new SQLiteConnection.
Have you tried this?
new SQLiteConnection(databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex)
I had threading issues in the past until I started using those flags
@xleon that worked for me!
many thanks 馃憤
Most helpful comment
Have you tried this?
I had threading issues in the past until I started using those flags