Is it possible to use sqlite.swift from multiple threads (read/write same table). I tried to determine it from from build setting - but did not found SERIALIZED, MULTITHREAD or THREADSAFE words.
Does it use original sqlite3 C library under the hood?
Asked
Active
Viewed 916 times
1

denys
- 2,437
- 6
- 31
- 55
1 Answers
2
The default for the SQLITE_THREADSAFE option is "serialized".
However, accessing the same database connection from multiple threads is likely to blow up because there is only one transaction per connection. You should use one connection per thread anyway.

CL.
- 173,858
- 17
- 217
- 259
-
Anyone interested in a Swift Sqlite library that has robust and **well-defined** multithreading behavior may enjoy looking at [GRDB](https://github.com/groue/GRDB.swift). – Gwendal Roué Sep 20 '17 at 17:23