diff options
author | Dan Kenigsberg <danken@redhat.com> | 2009-11-03 18:42:16 +0100 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2009-11-03 18:42:16 +0100 |
commit | bdb9c70e015181fba5f974cf233ceccbe29f1307 (patch) | |
tree | 82d3348bc56de3b0ece6e8bead0f95c3433a21cc | |
parent | bf95ba10437730b9f86f67e892d0d5d0ff804436 (diff) | |
download | libvirt-python-v8-bdb9c70e015181fba5f974cf233ceccbe29f1307.tar.gz libvirt-python-v8-bdb9c70e015181fba5f974cf233ceccbe29f1307.tar.xz libvirt-python-v8-bdb9c70e015181fba5f974cf233ceccbe29f1307.zip |
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.
-rw-r--r-- | libvirt-override.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libvirt-override.c b/libvirt-override.c index 5d24fd2..6c6155b 100644 --- a/libvirt-override.c +++ b/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; } |