*** 45,50 **** --- 45,65 ---- return retval; + An alternative approach is: + + *: Establish a busy handler procedure with *sqlite_busy_handler()*. In the + busy handler wait on a monitor or condition variable or event with + appropriate timeout. Give up with error after the busy handler has been + called some number of times. + + *: In all places where *sqlite_exec()* et.al. is called, signal the monitor or + condition variable or event after *sqlite_exec()* et.al. returned. This makes + other threads waiting in the busy handler runnable and finally one of them + getting out of the busy condition. + + An example implementation of that pattern can be found in the Java SQLite + wrapper on {link:http://www.ch-werner.de/javasqlite} in the *SQLite.JDBC2.JDBCConnection* class. + **Optimization** *Use transactions*. I cannot stress enough how important they become to improve performance: