[PATCH V2] patches: release the GIL while applying the patch
Yuya Nishihara
yuya at tcha.org
Thu Feb 22 07:41:01 EST 2018
On Thu, 22 Feb 2018 12:10:12 +0100, Boris Feld wrote:
> # 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
Bad macro. I've inserted one more block to make clang-format happy.
/* clang-format off */
{
Py_BEGIN_ALLOW_THREADS
r = mpatch_apply(out, in, inlen, patch);
Py_END_ALLOW_THREADS
}
/* clang-format on */
More information about the Mercurial-devel
mailing list