[Zope-CVS] CVS: Packages/Spread - spreadmodule.c:1.3

Jeremy Hylton jeremy@zope.com
Tue, 9 Oct 2001 14:04:02 -0400


Update of /cvs-repository/Packages/Spread
In directory cvs.zope.org:/tmp/cvs-serv28176

Modified Files:
	spreadmodule.c 
Log Message:
Add Py_BEGIN/END_ALLOW_THREADS macros


=== Packages/Spread/spreadmodule.c 1.2 => 1.3 ===
     if (!PyArg_ParseTuple(args, "s:join", &group))
 	return NULL;
+    Py_BEGIN_ALLOW_THREADS
     err = SP_join(self->mbox, group);
+    Py_END_ALLOW_THREADS
     if (err < 0)
 	return spread_error(err);
     Py_INCREF(Py_None);
@@ -420,7 +422,9 @@
 
     if (!PyArg_ParseTuple(args, "s:leave", &group))
 	return NULL;
+    Py_BEGIN_ALLOW_THREADS
     err = SP_leave(self->mbox, group);
+    Py_END_ALLOW_THREADS
     if (err < 0)
 	return spread_error(err);
     Py_INCREF(Py_None);
@@ -458,9 +462,11 @@
     if (!groups)
 	goto error;
 
+    Py_BEGIN_ALLOW_THREADS
     size = SP_receive(self->mbox, &svc_type, PyString_AS_STRING(sender), 
 		     self->max_groups, &num_groups, groups, &msg_type,
 		     &endian, buf_size, PyString_AS_STRING(message));
+    Py_END_ALLOW_THREADS
     
     if (size < 0)
 	goto error;
@@ -541,8 +547,10 @@
 	return NULL;
     }
 
+    Py_BEGIN_ALLOW_THREADS
     bytes = SP_multicast(self->mbox, svc_type, group, msg_type,
 			 msg_len, msg);
+    Py_END_ALLOW_THREADS
     if (bytes < 0)
 	return spread_error(bytes);
     return PyInt_FromLong(bytes);
@@ -648,10 +656,12 @@
     if (group_name == NULL)
 	return NULL;
 
+    Py_BEGIN_ALLOW_THREADS
     ret = SP_connect_timeout(spread_name, private_name, priority,
 			     membership, &_mbox, 
 			     PyString_AS_STRING(group_name),
 			     *sp_timeout);
+    Py_END_ALLOW_THREADS
 
     if (ret == ACCEPT_SESSION) {
 	mbox = new_mailbox(_mbox);