[libvirt] [PATCH] give up python interpreter lock before calling cb

suggested by danpb on irc --- python/libvirt-override.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 5d24fd2..53e36c0 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -2355,7 +2355,9 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED, opaque = (void *) PyvirVoidPtr_Get(py_opaque); if(cb) + LIBVIRT_BEGIN_ALLOW_THREADS cb (watch, fd, event, opaque); + LIBVIRT_END_ALLOW_THREADS return VIR_PY_INT_SUCCESS; } @@ -2379,7 +2381,9 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED, cb = (virEventTimeoutCallback) PyvirEventTimeoutCallback_Get(py_f); opaque = (void *) PyvirVoidPtr_Get(py_opaque); if(cb) + LIBVIRT_BEGIN_ALLOW_THREADS cb (timer, opaque); + LIBVIRT_END_ALLOW_THREADS return VIR_PY_INT_SUCCESS; } -- 1.6.2.5

On Mon, Nov 02, 2009 at 06:09:52PM +0200, Dan Kenigsberg wrote:
suggested by danpb on irc --- python/libvirt-override.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 5d24fd2..53e36c0 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -2355,7 +2355,9 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED, opaque = (void *) PyvirVoidPtr_Get(py_opaque);
if(cb) + LIBVIRT_BEGIN_ALLOW_THREADS cb (watch, fd, event, opaque); + LIBVIRT_END_ALLOW_THREADS
You'll need some curly braces around that, otherwise it is doing if(cb) LIBVIRT_BEGIN_ALLOW_THREADS cb (watch, fd, event, opaque); LIBVIRT_END_ALLOW_THREADS daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Nov 02, 2009 at 04:17:10PM +0000, Daniel P. Berrange wrote:
On Mon, Nov 02, 2009 at 06:09:52PM +0200, Dan Kenigsberg wrote:
suggested by danpb on irc --- python/libvirt-override.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 5d24fd2..53e36c0 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -2355,7 +2355,9 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED, opaque = (void *) PyvirVoidPtr_Get(py_opaque);
if(cb) + LIBVIRT_BEGIN_ALLOW_THREADS cb (watch, fd, event, opaque); + LIBVIRT_END_ALLOW_THREADS
You'll need some curly braces around that, otherwise it is doing
if(cb) LIBVIRT_BEGIN_ALLOW_THREADS
cb (watch, fd, event, opaque); LIBVIRT_END_ALLOW_THREADS
grr. bad case of python poisoning. anyway, the patch is here only for you not to forget it..

On Mon, Nov 02, 2009 at 06:25:20PM +0200, Dan Kenigsberg wrote:
On Mon, Nov 02, 2009 at 04:17:10PM +0000, Daniel P. Berrange wrote:
On Mon, Nov 02, 2009 at 06:09:52PM +0200, Dan Kenigsberg wrote:
suggested by danpb on irc --- python/libvirt-override.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 5d24fd2..53e36c0 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -2355,7 +2355,9 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED, opaque = (void *) PyvirVoidPtr_Get(py_opaque);
if(cb) + LIBVIRT_BEGIN_ALLOW_THREADS cb (watch, fd, event, opaque); + LIBVIRT_END_ALLOW_THREADS
You'll need some curly braces around that, otherwise it is doing
if(cb) LIBVIRT_BEGIN_ALLOW_THREADS
cb (watch, fd, event, opaque); LIBVIRT_END_ALLOW_THREADS
grr. bad case of python poisoning. anyway, the patch is here only for you not to forget it..
Okidoc, I fixed the syntax, it needed a few semi-columns too and pushed, thanks :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Dan Kenigsberg
-
Daniel P. Berrange
-
Daniel Veillard