On 13 Feb 2018, at 3:49am, Nick <haveagoodtime2...@gmail.com> wrote: > is it OK to use "threadsafe=2 and > 2 connections" in my apps if the 2 threads may write at the same time?
Yes. <https://sqlite.org/compile.html#threadsafe> "When compiled with SQLITE_THREADSAFE=2, SQLite can be used in a multithreaded program so long as no two threads attempt to use the same database connection (or any prepared statements derived from that database connection) at the same time." If your threads are using different database connections it's fine. If one connection has a lock on the database SQLite will cause the other one to wait until the database is free again. You should set the timeout to a minute or two using <https://sqlite.org/c3ref/busy_timeout.html> int sqlite3_busy_timeout(sqlite3*, int ms); or <https://sqlite.org/pragma.html#pragma_busy_timeout> PRAGMA busy_timeout = milliseconds; Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users