Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sqlite3_interrupt #518

Merged
merged 1 commit into from
Apr 21, 2016
Merged

Conversation

briangreenery
Copy link
Contributor

This change adds support for sqlite3_interrupt. This makes it possible to interrupt a long running query.

I called the function synchronously instead of going through db->Schedule because if it was scheduled it wouldn't be possible to interrupt exec. This is because while exec is running the work queue is not processed. Also, the sqlite3_interrupt function doesn't do any I/O or acquire any locks, so it won't block the javascript thread.

The downside of calling sqlite3_interrupt synchronously means that it has to check whether the database is open, and has to check that sqlite3_close is not about to be run by another thread. Basically, if sqlite3_interrupt is called on an already closed database, then it could cause memory corruption.

To avoid this, I added a closing variable that's set right before sending a close to a worker thread. The open variable isn't sufficient because it's only set to false after sqlite3_close has been called.

@hrundik
Copy link

hrundik commented Apr 21, 2016

@springmeyer : my team is also interested in this feature. Do you plan to merge this PR? What is the obstacle of not merging?

@panther7
Copy link

Hi, please add this to docs API. Thanks

@mtgto mtgto mentioned this pull request Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants