Until case 42544 is fixed, I’m looking at coding up a workaround. This case relates to the fact that, if two threads try to write to an SQLite db at the same time, one may get “database is locked”. Ordinarily, setting an SQLite timeout should cause one thread to sleep for a while and try again later. This is handled inside the SQLite library, but it just uses an ordinary system sleep, which hangs the whole app until the timeout expires.
I thought I would just leave the timeout at zero, which avoids SQLite itself trying to handle the error. I can do thread.sleep() myself which allows the other thread to proceed. This should be easy enough, but suppose the thread needing to sleep is the main thread. How do I sleep the main thread?