Blame SOURCES/0009-Add-macros-to-release-GIL-lock.patch

a02209
From 676f48d6e70f8406b36a004669d923825db51e2f Mon Sep 17 00:00:00 2001
a02209
From: Jiri Konecny <jkonecny@redhat.com>
a02209
Date: Mon, 11 May 2015 13:16:26 +0200
a02209
Subject: [PATCH] Add macros to release GIL lock
a02209
a02209
Other threads are blocked when GIL is not released before the time consuming
a02209
functions.
a02209
---
a02209
 libiscsi/pylibiscsi.c | 16 +++++++++++++---
a02209
 1 file changed, 13 insertions(+), 3 deletions(-)
a02209
a02209
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
a02209
index 8800853..40b5955 100644
a02209
--- a/libiscsi/pylibiscsi.c
a02209
+++ b/libiscsi/pylibiscsi.c
a02209
@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self)
a02209
 static PyObject *PyIscsiNode_login(PyObject *self)
a02209
 {
a02209
 	PyIscsiNode *node = (PyIscsiNode *)self;
a02209
+	int ret;
a02209
 
a02209
-	if (libiscsi_node_login(context, &node->node)) {
a02209
+	Py_BEGIN_ALLOW_THREADS
a02209
+	ret = libiscsi_node_login(context, &node->node);
a02209
+	Py_END_ALLOW_THREADS
a02209
+
a02209
+	if (ret) {
a02209
 		PyErr_SetString(PyExc_IOError,
a02209
 				libiscsi_get_error_string(context));
a02209
 		return NULL;
a02209
@@ -551,6 +556,7 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
a02209
 	const struct libiscsi_auth_info *authinfo = NULL;
a02209
 	struct libiscsi_node *found_nodes;
a02209
 	PyObject* found_node_list;
a02209
+	int ret;
a02209
 
a02209
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
a02209
 					kwlist, &address, &port,
a02209
@@ -570,8 +576,12 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
a02209
 		}
a02209
 	}
a02209
 
a02209
-	if (libiscsi_discover_sendtargets(context, address, port, authinfo,
a02209
-					  &nr_found, &found_nodes)) {
a02209
+	Py_BEGIN_ALLOW_THREADS
a02209
+	ret = libiscsi_discover_sendtargets(context, address, port, authinfo,
a02209
+					    &nr_found, &found_nodes);
a02209
+	Py_END_ALLOW_THREADS
a02209
+
a02209
+	if (ret) {
a02209
 		PyErr_SetString(PyExc_IOError,
a02209
 				libiscsi_get_error_string(context));
a02209
 		return NULL;
a02209
-- 
a02209
2.26.2
a02209