|
|
62f653 |
From bd26fd7e7f91e5c4c6903c3d7e1a375a14261a48 Mon Sep 17 00:00:00 2001
|
|
|
62f653 |
From: Jiri Konecny <jkonecny@redhat.com>
|
|
|
62f653 |
Date: Mon, 11 May 2015 13:16:26 +0200
|
|
|
62f653 |
Subject: [PATCH 18/32] 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
|
|
|
62f653 |
index 88008538f04f..40b59553a28e 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 |
--
|
|
|
62f653 |
2.14.4
|
|
|
62f653 |
|