Hello, After an upgrade from sqlite 3.2.2 to 3.2.5, i got problems with strange SQLITE_MISUSE returns. After a little investigation, i found it was the --enable-threadsafe option correction in Check-In 2623.
It seems SQLite, in os_unix.c sqlite3OsLock with the SQLITE_UNIX_THREADSAFE flag (corrected), force a connection to be always used by the same thread. The SET_THREADID is only done during an 'open'. My code is sharing a pool of SQLite connections on multiple databases between a bunch of treatment threads. Each thread pops a connection from the pool safely and push it back once finished. So i get a SQLITE_MISUSE return from sqlite3OsLock when a second thread try to use safely an unused connection. Here is a possible way for the enhancement: - a "release" function called at the end of treatment to set the SQLite OsFile->tid to 0. - Atomically, a thread try to 'CHECK_THREADID' in sqlite3OsLock and if the OsFile->tid eq 0, just call SET_THREADID. Bye, -- Guillaume FOUGNIES Eulerian Technologies