On 13 Feb 2018, at 9:14am, Nick <haveagoodtime2...@gmail.com> wrote:

> So I think "threadsafe=2 + more than 1 connection + busy_handler" is a good
> way to use.

This is the normal way to use SQLite.

> Another possible way is "threadsafe=1 and share 1 connection", but if thread
> 1 begins a transaction, then the SQL of thread 2 will also be executed
> within the transaction I guess. That may cause some unpredictable problems.

SQLite does not know about your threads.  It expects each connection to be used 
only in sequences which make sense.

> BTW, if I use "threadsafe=0 and more than 1 connection", there will not be
> "database is locked" any more even if two threads writing at the same time,
> as mutex is disabled on core. Is it correct? 

threadsafe=0 disables mutexes / locking.  This makes SQLite faster.  But you 
should also think of it as using other tricks to speed up SQLite.  And these 
tricks are unsafe if you try to use SQLite from two threads at once.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to