From: Dan Kenigsberg Date: Tue, 3 Nov 2009 17:42:16 +0000 (+0100) Subject: give up python interpreter lock before calling cb X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9ae8fa5839e4fab14bee18f4d036f0ce78afa175;p=libvirt.git give up python interpreter lock before calling cb suggested by danpb on irc, patch by danken fixed for proper C syntax * python/libvirt-override.c: on event callback release the python interpreter lock and take it again when coming back so that the callback can reinvoke libvirt. --- diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 5d24fd2277..6c6155b9f2 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -2354,8 +2354,11 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED, cb = (virEventHandleCallback) PyvirEventHandleCallback_Get(py_f); opaque = (void *) PyvirVoidPtr_Get(py_opaque); - if(cb) + if(cb) { + LIBVIRT_BEGIN_ALLOW_THREADS; cb (watch, fd, event, opaque); + LIBVIRT_END_ALLOW_THREADS; + } return VIR_PY_INT_SUCCESS; } @@ -2378,8 +2381,11 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED, cb = (virEventTimeoutCallback) PyvirEventTimeoutCallback_Get(py_f); opaque = (void *) PyvirVoidPtr_Get(py_opaque); - if(cb) + if(cb) { + LIBVIRT_BEGIN_ALLOW_THREADS; cb (timer, opaque); + LIBVIRT_END_ALLOW_THREADS; + } return VIR_PY_INT_SUCCESS; }