Skip to content

Commit

Permalink
Release GIL in Walker.__next__
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
jorio committed Nov 19, 2023
1 parent 026048a commit 3307e64
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/walker.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ Walker_iternext(Walker *self)
git_commit *commit;
git_oid oid;

Py_BEGIN_ALLOW_THREADS
err = git_revwalk_next(&oid, self->walk);
Py_END_ALLOW_THREADS

if (err < 0)
return Error_set(err);

Expand Down

0 comments on commit 3307e64

Please sign in to comment.