Hi,

There was a recent discussion about this, with the subject "Problems with threadsafe opt correction #2623"

On 5/9 2005 Richard wrote:
"The restriction that a DB handle can only be used from a single
thread is currently only enforced on Unix, because Unix boxes
are the only place where using DB handles in multiple threads is
a problem.
-- D. Richard Hipp <[EMAIL PROTECTED]>
"

From personal experience it seems sqlite is completely safe in multi-threaded environments when shared the same database handle on windows platforms, provided that you use an adequate locking mechanism.

The drawback is portability to other platforms that implement threading different and are not safe on concurrent file access, even if well-sequenced. On unix sqlite enforces a database handle to be used by the same thread as that opened it. Some people claimed having no problems, but this seems os/kernel dependent.

rene



Wilson Yeung wrote:

I wasn't doing a very good job paying attention to the FAQ about
threading and SQLite when I wrote a bunch of code on win32.

I'm sharing sqlite3 database handles between threads, although I am
ensuring that no two threads are executing against the sqlite3
database handle at the same time.

The threads are in fact interleaving, and the sqlite3 database handle
is indeed being shared between the two threads, and everything is
working as I'd like it to work...

Is the warning about threads in the FAQ specifically apply to Linux
systems?  Or can we pretty much say that my code is going to
eventually break on win32 and I'm lucky that it hasn't already?

Wilson

Reply via email to