Multithreading In Sqlite
I am using System.data.sqlite for connecting to Sqlite Database, as per the Sqlite documentation, users can enable multithreading by using SQLITE_OPEN_NOMUTEX flag as part of conne
Solution 1:
The threading mode is determined by compile time, startup or runtime options. More details here:
http://www.sqlite.org/threadsafe.html
The docs say serialized is the default which means you're fine to use from multiple threads - it will guard you. If you want more parallelism, you can use multi-threaded mode.
If you use it in multi-threaded mode, make sure that calls are synchronized for a given connection. If you want parallel work, use multiple connections and guard the connection.
The API itself hints at this by taking the db object (connection) as an argument to many functions that you call sequentially. For example, look at these functions that you call to get an error:
intsqlite3_errcode(sqlite3 *db);
constchar *sqlite3_errmsg(sqlite3*);
Post a Comment for "Multithreading In Sqlite"