Marten Feldtmann <[EMAIL PROTECTED]> wrote: > I've read the book from Michael Owens about SQLite and also > read the parts about threads and sqlite3. > > Actually it seems to be possible to use the same connection > handler from different threads - but within a transaction > only one thread is allowed to access the library with that > particular connection handler.
This restriction is due to problems in the way pthreads and posix advisory locks interact in some versions of Linux with the 2.4 kernel. If you are using win32 or mac os-x or linux with a 2.6 kernel, this restriction does not apply. > > Is this also true for functions like "errcode" and > "errmsg" ? I suspect these will work regardless. Of course, nothing will work if you using the same connection handle in two different threads at the same time. You may want to put a mutex on the connection handle so that you don't try to use the same handle at the same time in two different threads. You best bet, in my view, is to not use threads at all. Here is a quote (slightly modified) from Bryan Oakley that I saw earlier today and kind of like: "You almost never need threading. A good rule of thumb is that you don't need threading unless you *know* you need threading. If you only *think* you need it, you don't need it. And even if you *know* you need threading, you may not." -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------