thanks everybody, especially Pavel Ivanov who did not give himself a 
trouble to look at the source though i did.

but as far as i understand this is only applicable to current version of 
sqlite and future releases may change things.

Jay A. Kreibich wrote:

 >   If each thread is using its own, private database connection, then
 >   you're safe.  If multiple threads are sharing a database connection
 >   and using the "serialized" thread mode, then you have a race
 >   condition as it is possible for the database connection to be
 >   handed off between statements.  The value returned by
 >   last_insert_rowid() may be invalid by the time it is called.

Yes, i share one database handle between multiple threads. actually i 
have some class Storage which is accessible from multiple threads.
I defined SQLITE_TREADSAFE and thought that there could be no racing.

as for http://cvs.hwaci.com/threadsafe.html

 > SQLite support three different threading modes:
 >
 >   1. Single-thread. In this mode, all mutexes are disabled and SQLite 
is unsafe to use in more than a single thread at once.
 >   2. Multi-thread. In this mode, SQLite can be safely used by 
multiple threads provided that no single database connection is used 
simultaneously in two or more threads.
 >   3. Serialized. In serialized mode, SQLite can be safely used by 
multiple threads with no restriction.

as you see in _serialized_ mode "SQLite can be safely used by multiple 
threads with no restriction".

do i misunderstand something?

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

Reply via email to