Hi,

I'm trying to use SQLite in a multi-threaded application. I've done some tests 
and it seems that using the same connection on multiple threads is faster than 
having one connection per thread.

However, http://www.sqlite.org/c3ref/errcode.html states:

"When the serialized threading mode (http://www.sqlite.org/threadsafe.html) is 
in use, it might be the case that a second error occurs on a separate thread in 
between the time of the first error and the call to these interfaces. When that 
happens, the second error will be reported since these interfaces always report 
the most recent result."

So, this is a problem in my application (and I definitely need multi threading).

Obtaining an exclusive lock for the database connection, as suggested in the 
documentation, is not an option for me because even read only statements 
(SELECT) can potentially return an error. And obtaining an exclusive lock for a 
read statement eliminates all concurrency there is in SQLite.

So the only solution I can come up with is to make "sqlite3_errmsg()" (and 
related functions) use thread local memory.

Is there (or has there ever been made) any attempt on storing the error message 
in thread local memory? (I'm a C# and Java developer, so I'm not sure whether 
thread local memory even exists in C. It does in C# and Java though.)

Best regards
Sebastian

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to