Hello, I have program that continuously runs several threads (about 4 to 10) which concurrently read and write to an SQLite database. From http://www.sqlite.org/sharedcache.html it seems to me that I should be using shared cache mode.
Until now, I have set the busy timeout to 500 msec and never had to deal with SQLITE_BUSY errors. However, there seems to be no corresponding function for the SQLITE_LOCKED errors that are generated in shared cache mode. So I changed the code manually sleep for a random amount (0 to 100 msec) and then try to execute the statement again if it encounters SQLITE_LOCKED. But now the threads are often waiting for more than 1 second before they finally get their query executed. I suspect this is because the random sleep is wasting a lot of time, while without shared cache (and with enabled busy timeout) a thread blocks and gets revived as soon as the lock on the database is released. How can I avoid this problem? Is there a way to set a busy timeout for SQLITE_LOCKED as well? Or a more clever method instead of sleeping for random amounts? Or should I just avoid using shared cache mode? Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users