Dan Kennedy wrote:
It's not recommended. Some operating systems (notably linux), have
problems releasing file-locks established by other threads.

You might be Ok on Windows, I'm not sure. But be careful, the database locking might not work.

Actually, I would say that you're probably better off wrapping the calls with a mutex. Just make sure that a transaction is started and completed by the same thread. I say you're better off because there appears to be problems with the file locking for multiple threads:

http://www.sqlite.org/cvstrac/tktview?tn=1272

Cheers,
Chris.

--- Cory Nelson <[EMAIL PROTECTED]> wrote:


Yep, that's how I do it.  Works fine.

On 6/10/05, Brown, Dave <[EMAIL PROTECTED]> wrote:

I read the docs on thread safety, where it says:

"Threadsafe" in the previous paragraph means that two or more threads can
run SQLite at the same time on different "sqlite" structures returned from
separate calls to sqlite_open(). It is never safe to use the same sqlite
structure pointer simultaneously in two or more threads.

QUESTION: If I wrap the database calls with a mutex, so two threads can't
use the sqlite structure simultaneously, is this ok?  (Even though a thread
which didn't create the struct will be using it).

-Dave



--
Cory Nelson
http://www.int64.org





                
__________________________________ Discover Yahoo! Find restaurants, movies, travel and more fun for the weekend. Check it out! http://discover.yahoo.com/weekend.html

Reply via email to