From 55acf365ea76b908388ca9726232bde90242cdcb Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 20 Oct 2009 18:44:17 +0200 Subject: [PATCH] releasing python global lock when doing blocking operations --- bindings/python/pyzmq.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/python/pyzmq.cpp b/bindings/python/pyzmq.cpp index 54c16de9..b180bcd5 100644 --- a/bindings/python/pyzmq.cpp +++ b/bindings/python/pyzmq.cpp @@ -239,7 +239,10 @@ PyObject *socket_send (socket_t *self, PyObject *args, PyObject *kwdict) memcpy (zmq_msg_data (&data), PyString_AsString (msg), zmq_msg_size (&data)); + Py_BEGIN_ALLOW_THREADS rc = zmq_send (self->handle, &data, flags); + Py_END_ALLOW_THREADS + int rc2 = zmq_msg_close (&data); assert (rc2 == 0); @@ -286,7 +289,9 @@ PyObject *socket_recv (socket_t *self, PyObject *args, PyObject *kwdict) int rc = zmq_msg_init (&msg); assert (rc == 0); + Py_BEGIN_ALLOW_THREADS rc = zmq_recv (self->handle, &msg, flags); + Py_END_ALLOW_THREADS if (rc != 0 && errno == EAGAIN) { Py_INCREF (Py_None);