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

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