Function Database.interrupt

Interrupts any pending database operations.

void interrupt();

It's safe to call this function from anouther thread.

See also

http://www.sqlite.org/c3ref/interrupt.html.