Is this the only reason for the...
"database handle can only be used on the same thread
that opened it"
...rule? Does Windows have that issue?
If so, can we convert this to a compile time option?
Eg. OS_SUPPORTS_THREADSAFE_FILE_LOCKS or similar
flag which can be set to true for OSes which do not
have this issue?
My application is Windows only. It's also a
component that can be passed around between threads.
Hence I have to do a 'thread-id check' on *every*
method call into the component.
This rule also forces us to pass around the database
filename and path rather than the handle. Since on
any call, if the 'thread-id check' fails, the
database has to be re-opened.
D. Richard Hipp wrote:
On Wed, 2005-08-31 at 12:53 +0200, Guillaume Fougnies wrote:
My code is sharing a pool of SQLite connections on
multiple databases between a bunch of treatment
Each thread pops a connection from the pool safely
and push it back once finished.
This works on some systems but not on others. On some
versions of Linux, a thread is not able to override locks
created by a different thread in the same process. When
that happens, a database connection created on one thread
will not be usable by a different thread.