diff Modules/socketmodule.c @ 20811:8d4b6642a604 2.1

wrap SSL_read and SSL_write in Py_{BEGIN,END}_ALLOW_THREADS. other half of backport of guido's 1.188
author Anthony Baxter <anthonybaxter@gmail.com>
date Thu, 01 Nov 2001 14:25:38 +0000
parents 464d213da888
children e69b21f2529e
line wrap: on
line diff
--- a/Modules/socketmodule.c	Thu Nov 01 14:18:29 2001 +0000
+++ b/Modules/socketmodule.c	Thu Nov 01 14:25:38 2001 +0000
@@ -2331,7 +2331,9 @@
 	if (!PyArg_ParseTuple(args, "s#:write", &data, &len))
 		return NULL;
 
+	Py_BEGIN_ALLOW_THREADS
 	len = SSL_write(self->ssl, data, len);
+	Py_END_ALLOW_THREADS
 	return PyInt_FromLong((long)len);
 }
 
@@ -2347,7 +2349,9 @@
 	if (!(buf = PyString_FromStringAndSize((char *) 0, len)))
 		return NULL;	/* Error object should already be set */
 
+	Py_BEGIN_ALLOW_THREADS
 	count = SSL_read(self->ssl, PyString_AsString(buf), len);
+	Py_END_ALLOW_THREADS
 	res = SSL_get_error(self->ssl, count);
 
 	switch (res) {