Of course. In fact that is how it is used in the shell.c code to allow the interruption of long running queries ... sqlite3_interrupt is attached to the SIGINT/SIGBREAK signal handler so that a BREAK from the keyboard interrupts the query execution.
--- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-----Original Message----- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of James K. Lowden >Sent: Wednesday, 2 January, 2019 13:23 >To: sqlite-users@mailinglists.sqlite.org >Subject: Re: [sqlite] Using sqlite3_interrupt with a timeout > >On Mon, 31 Dec 2018 14:25:41 -0700 >"Keith Medcalf" <kmedc...@dessus.com> wrote: > >> 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) > >If I don't want to use threads, can I call sqlite3_interrupt from a >signal handler? > >--jkl > >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users