[libvirt] [PATCH] Fix threading problems in python bindings
Matthias Bolte
matthias.bolte at googlemail.com
Wed Nov 25 12:29:30 UTC 2009
2009/11/25 Daniel P. Berrange <berrange at redhat.com>:
> * libvirt-override.c: Add many missing calls to allow threading
> when entering C code, otherwise python blocks & then deadlocks
> when we have an async event to dispatch back into python code
> ---
> python/libvirt-override.c | 106 ++++++++++++++++++++++++++++++++++++++++----
> 1 files changed, 96 insertions(+), 10 deletions(-)
>
> diff --git a/python/libvirt-override.c b/python/libvirt-override.c
> index b885190..0f7db9c 100644
> --- a/python/libvirt-override.c
> +++ b/python/libvirt-override.c
[...]
> @@ -418,10 +456,15 @@ libvirt_virDomainPinVcpu(PyObject *self ATTRIBUTE_UNUSED,
> VIR_UNUSE_CPU(cpumap, i);
> }
>
> - virDomainPinVcpu(domain, vcpu, cpumap, cpumaplen);
> + LIBVIRT_BEGIN_ALLOW_THREADS;
> + i_retval = virDomainPinVcpu(domain, vcpu, cpumap, cpumaplen);
> + LIBVIRT_END_ALLOW_THREADS;
> Py_DECREF(truth);
> free(cpumap);
>
> + if (i_retval < 0)
> + return VIR_PY_INT_FAIL;
> +
> return VIR_PY_INT_SUCCESS;
> }
>
You should at least mention this additional fix in the commit message.
ACK!
Matthias
More information about the libvir-list
mailing list