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?



"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 

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


        int sqlite3_busy_timeout(sqlite3*, int ms);



        PRAGMA busy_timeout = milliseconds;

sqlite-users mailing list

Reply via email to