summaryrefslogtreecommitdiff
path: root/bindings/python
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-10-20 18:44:17 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-10-20 18:44:17 +0200
commit55acf365ea76b908388ca9726232bde90242cdcb (patch)
tree89bdf9c5e33b6368c5fa68532871c68c51ec7a84 /bindings/python
parent8b08047cb08dd6ba7ae142007f82607183574ef6 (diff)
releasing python global lock when doing blocking operations
Diffstat (limited to 'bindings/python')
-rw-r--r--bindings/python/pyzmq.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/bindings/python/pyzmq.cpp b/bindings/python/pyzmq.cpp
index 54c16de..b180bcd 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);