On Fri, 27 Feb 2004, D. Richard Hipp wrote: >[EMAIL PROTECTED] wrote: > > > > I'm trying to access the database from two threads: the UI thread mostly > > reads and occasionally updates rows, while the network thread loads new > > messages and inserts them. Will that work, or do I just misunderstand how > > SQLite does multithreading? > > > >Each thread should do its own sqlite_open() and they should not share >the sqlite* pointers that their respective sqlite_open() calls return.
I've always wondered. Is it safe to access the same sqlite* pointer sequentially? I have a construct in which I wrap the sqlite* pointer in a structre with a mutex, then lock the mutex when I begin a transaction, and unlock the mutex on commit or rollback. All other access is protected with the mutex and transaction. I guess what I'm asking is that there are no thread local assumptions in the code. I guess not, so the above should be safe? Cheers, Christian -- "The problem with the French is that they don't have a word for entrepreneur" George W. Bush ---------------------------------------------------------------------- /"\ \ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]