To avoid races you should do this: Main thread: - sqlite3async_initialize() - Starts child thread - sqlite3_open_v2() - sqlite3_exec(), sqlite3_prepare_v2()/sqlite3_step(), etc - sqlite3_close() - Halts and joins child thread - sqlite3async_shutdown() - exits
Child thread: - sqlite3async_run() Pavel On Tue, Apr 5, 2011 at 1:45 PM, Ricky Huang <rhhu...@soe.ucsd.edu> wrote: > On Apr 4, 2011, at 7:10 PM, Pavel Ivanov wrote: > >>> Can someone be so kind as to provide a short example of initializing >>> asynchronous module, opening DB for read/write, create a table, and write >>> some data to it? >> >> […] All you need to do is to initialize async module and call >> sqlite3async_run in the dedicated thread. […] > > Thanks for getting back to me Pavel. > > So let me see if I understand what you said: > > Main thread: > - Starts child thread > - sqlite3_open_v2() > - sqlite3_exec(), sqlite3_prepare_v2()/sqlite3_step(), etc > - sqlite3_close() > - Halts and joins child thread > > Child thread: > - sqlite3async_initialize() > - sqlite3async_run() > - sqlite3async_shutdown() > > > is that correct? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users