1 Star 0 Fork 15

fe.zhang/iscsi-initiator-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0009-Add-macros-to-release-GIL-lock.patch 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
From 676f48d6e70f8406b36a004669d923825db51e2f Mon Sep 17 00:00:00 2001
From: Jiri Konecny <jkonecny@redhat.com>
Date: Mon, 11 May 2015 13:16:26 +0200
Subject: [PATCH] Add macros to release GIL lock
Other threads are blocked when GIL is not released before the time consuming
functions.
---
libiscsi/pylibiscsi.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c
index 8800853..40b5955 100644
--- a/libiscsi/pylibiscsi.c
+++ b/libiscsi/pylibiscsi.c
@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self)
static PyObject *PyIscsiNode_login(PyObject *self)
{
PyIscsiNode *node = (PyIscsiNode *)self;
+ int ret;
- if (libiscsi_node_login(context, &node->node)) {
+ Py_BEGIN_ALLOW_THREADS
+ ret = libiscsi_node_login(context, &node->node);
+ Py_END_ALLOW_THREADS
+
+ if (ret) {
PyErr_SetString(PyExc_IOError,
libiscsi_get_error_string(context));
return NULL;
@@ -551,6 +556,7 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
const struct libiscsi_auth_info *authinfo = NULL;
struct libiscsi_node *found_nodes;
PyObject* found_node_list;
+ int ret;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO",
kwlist, &address, &port,
@@ -570,8 +576,12 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self,
}
}
- if (libiscsi_discover_sendtargets(context, address, port, authinfo,
- &nr_found, &found_nodes)) {
+ Py_BEGIN_ALLOW_THREADS
+ ret = libiscsi_discover_sendtargets(context, address, port, authinfo,
+ &nr_found, &found_nodes);
+ Py_END_ALLOW_THREADS
+
+ if (ret) {
PyErr_SetString(PyExc_IOError,
libiscsi_get_error_string(context));
return NULL;
--
2.26.2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fe_zhang/iscsi-initiator-utils.git
git@gitee.com:fe_zhang/iscsi-initiator-utils.git
fe_zhang
iscsi-initiator-utils
iscsi-initiator-utils
a8

搜索帮助