On 8/15/19, test user <example.com.use...@gmail.com> wrote: > Hello, > > If two processes are writing to the same db file, one will get a BUSY > response if the other has locked it. > > Currently the API lets you set a timeout. Does this just retry again after > a set amount of time?
Yes. It retries multiple times, increasing the wait time in between each attempt. > > Or is it possible to get notified immediately when the lock has been > released? Can I determine this by watching the file via OS system calls? > > Basically Id like the second process to wait the smallest amount of time > possible. With a timeout, it seems time is wasted waiting (if the lock has > already been released). SQLite could support this in theory. But if the process holding the lock is hung, that would hang the process waiting on the look too. And then we would get lots of complaints about how "SQLite hangs!" when in fact it was some other application that starts a transaction, then hangs doing unrelated processing, and causes one or more SQLite processes trying to access the same file to hang as well. Getting SQLITE_BUSY is annoying, but it is not nearly as annoying as getting a hung process. I am not aware of a way to do a blocking file lock with a timeout that is portable across operating systems. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users