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

Release GIL in Walker.__next__ #1249

Merged
merged 1 commit into from
Nov 20, 2023
Merged

Conversation

jorio
Copy link
Contributor

@jorio jorio commented Nov 19, 2023

The first call to git_revwalk_next may take a while to complete in large repositories – sometimes a couple of seconds.

This PR releases the Global Interpreter Lock (GIL) during git_revwalk_next to avoid locking up multithreaded applications. (Note: cffi wraps C function calls in a similar fashion.)

A possible use case for this is to keep a GUI application responsive while a background thread is iterating on a Walker. Before this change, pygit2 would hold onto the GIL while calling into git_revwalk_next, causing the UI thread to freeze.

The first call to git_revwalk_next may take a while to complete in large repositories -- sometimes a couple of seconds.

Release the GIL during git_revwalk_next to avoid locking up multithreaded applications. (Note: cffi wraps C function calls in a similar fashion.)
@jdavid jdavid merged commit 6e34900 into libgit2:master Nov 20, 2023
6 checks passed
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.

None yet

2 participants