On Thu, Jun 21, 2012 at 11:37 AM, Dennis Volodomanov <i...@psunrise.com> wrote: > On 22/06/2012 1:29 AM, Pavel Ivanov wrote: >> >> Do you have mutex surrounding statement execution in these threads? You >> should use it or compile with SQLITE_THREADSAFE=1. Pavel > > > No, I don't have mutexes for those, as I assumed that THREADSAFE=2 would > protect them. I'm not clear about the exact difference between 1 and 2, > having read the docs a few times.
>From http://www.sqlite.org/compile.html: "SQLITE_THREADSAFE=1 sets the default threading mode to Serialized. SQLITE_THREADSAFE=2 sets the default threading mode to Multi-threaded". And from http://www.sqlite.org/threadsafe.html: "In serialized mode, SQLite can be safely used by multiple threads with no restriction. In Multi-thread mode, SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads". In other words with SQLITE_THREADSAFE=1 SQLite itself is responsible for protecting concurrent access to connection with mutex, with SQLITE_THREADSAFE=2 developer using SQLite is responsible for that. And you was just lucky not getting application crash without mutex. Pavel _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users