On Jan 11, 2009, at 3:37 AM, Lawrence Gold wrote:

> This question may sound a bit daft, but I'll ask anyway: If I use  
> SQLite
> in the default SQLITE_CONFIG_SERIALIZED threading mode and share a
> connection among threads, does that connection support multiple
> simultaneous reads, or will each read access be serialized?

With CONFIG_SERIALIZED, database and prepared statement handles are
thread-safe objects. All API calls to a single database handle or
any of its statement handles are serialized.

> I'm assuming that for maximum concurrency in a multithreaded app, I
> would need to set the threading mode to SQLITE_CONFIG_MULTITHREAD and
> have a connection per thread, but I wanted to confirm this before I  
> made
> any big code changes.

In CONFIG_MULTITHREAD mode, you are responsible for serializing calls
on a single database handle and its statement handles yourself. If you
make calls on a single database handle from two or more threads  
simultaneously
the application will likely crash or malfunction.

The degree of concurrency provided is the same in either case, just that
in CONFIG_MULTITHREAD mode you are responsible for enforcing it  
yourself.

Dan.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to