That is, of course (I forgot the stmt argument to sqlite3_stmt_busy in all the whizing around):
def interrupt_function(db, stmt, timeout, whizround) while whizround and !sqlite3_stmt_busy(stmt) /* whizround waiting for statement to start */ sleep(0.001) sleep(timeout) /* wait for our timeout */ if sqlite3_stmt_busy(stmt) /* if statement is running */ sqlite3_interrupt(db) /* interrupt it */ def run_query_with_timeout(db, query, timeout, whizround) stmt = prepare(db, query) create_thread A interrupt_function(db, stmt, timeout, whizround) while sqlite3_step(stmt) == SQLITE_ROW ... process the row ... cancel_thread A join_thread A /* make sure the thread is ended */ sqlite3_finalize(stmt) --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users