I m using System.Data.Sqlite in my c# application.
I need to run Sqlite cmds in an async manner so that my application is not blocked in case of any rogue query/operation. Since sqlite does not provide any anyc wrappers, I am calling my queries within a Task.Run method.
After waiting for a specified timeout, I want to end the query.
I tried calling Connection cancel or connection close from the calling thread to raise an exception in the task and exit the task.
With long queries/updates, closing the connection seems to be working fine, raising an exception on the task and releasing the file handle.
Calling Cancel which internally calls interrupt, however, works for long running queries but not for long running updates.
Is it fine to call System.Data.Sqlite connection close from a thread while another thread in performing an operation on it to stop that operation.