Hey guys. As was being discussed yesterday, I have four processes accessing the same database file. When they perform an sqlite action, I wish them to block if the DB is not available. SQLite does not block if it finds the db busy or locked, it returns an error code.
I plan on using busy-waiting to implement my block - here is my code: bool tryAgain = true; while (tryAgain) { tryAgain = false; ClearErrorString(); iResult = sqlite3_exec(m_pDatabase, sql, Callback, (void*)pResultSet, &m_szErrorString); if (iResult == SQLITE_LOCKED || iResult == SQLITE_BUSY) { tryAgain = true; Platform::sleep(10); } } Any feedback on this (especially with reference to how long I should sleep for) would be much appreciated. Also, I know this is pretty horrible - any suggestions for a better approach would also be great. Thanks, Ian _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users