[PATCH V2] patches: release the GIL while applying the patch
Boris Feld
boris.feld at octobus.net
Thu Feb 22 11:10:12 UTC 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1517839431 -3600
# Mon Feb 05 15:03:51 2018 +0100
# Node ID 585005c9c4901f4f94847e8637fbc58cc5b29c56
# Parent 0c34cb461a1ea5d3f8e1300e0b8bc16ed8fa8802
# EXP-Topic parallel-patching
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 585005c9c490
patches: release the GIL while applying the patch
This will allow multiple threads to apply patches at the same time.
diff --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c
--- a/mercurial/cext/mpatch.c
+++ b/mercurial/cext/mpatch.c
@@ -109,7 +109,9 @@ static PyObject *patches(PyObject *self,
goto cleanup;
}
out = PyBytes_AsString(result);
+ Py_BEGIN_ALLOW_THREADS
r = mpatch_apply(out, in, inlen, patch);
+ Py_END_ALLOW_THREADS
if (r < 0) {
Py_DECREF(result);
result = NULL;
More information about the Mercurial-devel
mailing list