-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/24/2015 03:08 AM, Jeff M wrote: > I've checked all of your suggestions and nothing is amiss.
You ran valgrind and it said everything is fine? That would be shocking. > I don't understand how the main thread can run before the > background task has completed -- and specifically while sqlite_step > is still executing. If the database is busy/locked then sqlite_step can relinquish the mutex, call the busy handler and try again. > Apparently, sqlite_step() can relinquish control to the main > thread. SQLite does not contain a thread scheduler (we'll ignore pragma threads). You've either got 100% correct code in which case the underlying issues are to do with concurrency (need to check memory barriers, marking as volatile etc), or there is a bug in the code related to object/pointer lifetimes or similar. With the latter changing things changes where collateral damage happens, but doesn't actually fix the issue. It is almost certainly the second case. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlXbSzwACgkQmOOfHg372QR/XACfV5Iw0umJ1smYygE/Komcemx0 46gAnjumLvNw1/fj2uFpIEdTwYnmhlOd =HcCt -----END PGP SIGNATURE-----