"Gene Allen"
<[EMAIL PROTECTED]> wrote in
message
news:!&[EMAIL PROTECTED]
> I'm using SQLite v. 3.5 in my multithreaded application.
>
> I have 2 threads both writing to the same database, different tables
> but same database.  All is good until one of the threads goes under
> HEAVY load, then the other thread blocks never to return (on a bind
> statement).

The two threads are using the same connection, right? Each connection 
has a mutex that SQLite locks on every API call involving this 
connection.

> Is opening the database in each thread, really the only thing I need
> to worry about when I have mutilple threads are using the same
> database file, as long as that are using seperate tables?

No. Multiple connections (whether from different processes or within the 
same process) essentially maintain a multiple-readers-single-writer lock 
on the whole database, not per table. However, you can achieve a sort of 
table-level locking by enabling shared cache: 
http://sqlite.org/sharedcache.html

Igor Tandetnik 



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

Reply via email to