On 02/08/2015 04:30 PM, Neo Anderson wrote:
The doc says:
Multi-thread.
In this mode, SQLite can be safely used by multiple threads provided that
no single database connection is used simultaneously in two or more threads.
I have a scenario that every sqlite3_calls around a single database connection
is protected by a recursive mutex, but I have very strange runtime error in
sqlite3.c and each time the error occurs at a different place.
Does this mean the following statement is true:
In muti-thead mode, a single database connection cannot be shared among threads
even if any activity around the connection is protected by a mutex.
Not true.
The only difference between multi-threaded and serialized mode is that,
internally, every sqlite3_xxx() API call grabs a recursive mutex to
prevent two threads from simultaneously accessing the database handle
structure. i.e. the same thing your code is doing externally.
Note that calls on statement handles (i.e. sqlite3_step(),
sqlite3_column_text() etc.) count as calls on the database handle that
created them. So you need to protect them with the same mutex.
Does the application work if you configure SQLite to serialized mode?
Dan.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users