On 23/11/62 17:02, Mario M. Westphal wrote:
I have an issue with concurrency. This may be the intended behavior of
SQLite. Or I'm doing something wrong.
If somebody could shed a light, I would be thankful.
I compile and use SQLite on Windows with VStudio.
I compile it with SQLITE_THREADSAFE=1
At runtime, I use sqlite3_open_v2 () and set the flag SQLITE_OPEN_NOMUTEX.
I use SQLite in WAL mode.
My application uses several threads. Each thread opens its own database
connection.
Two threads run in parallel.
Thread A does a lengthy UPDATE to table_A (prepared statement). This update
takes, say, 5 seconds.
Thread B uses a prepared statement to SELECT data from an unrelated table_B.
Thread_B is blocked seconds in sqlite3Step because lockBtreeMutex() blocks
in a mutex.
I did not expect this.
Why is thread_B blocked when doing a read just because SQLite is writing to
another table?
Is this the expected behavior or am I doing something stupid in my code. And
if so, what to check?
This should only happen if you are using shared-cache mode. Don't use
shared-cache mode.
Dan.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users