From 7dd27fca74e9a9aed22d27568f033a4b817a665b Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 28 May 2022 22:04:52 +0200 Subject: Remove various accesses to the Python Global Interpreter Lock. --- plugins/pychrysalide/analysis/loaded.c | 5 ----- plugins/pychrysalide/core/queue.c | 17 ----------------- 2 files changed, 22 deletions(-) diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c index 89762d3..c8674a5 100644 --- a/plugins/pychrysalide/analysis/loaded.c +++ b/plugins/pychrysalide/analysis/loaded.c @@ -958,7 +958,6 @@ static PyObject *py_loaded_content_analyze_and_wait(PyObject *self, PyObject *ar int connect; /* Connexion à la base ? */ int cache; /* Préparation de rendu ? */ int ret; /* Bilan de lecture des args. */ - PyThreadState *_save; /* Sauvegarde de contexte */ GLoadedContent *content; /* Version GLib de l'élément */ bool status; /* Bilan de l'opération */ @@ -993,12 +992,8 @@ static PyObject *py_loaded_content_analyze_and_wait(PyObject *self, PyObject *ar content = G_LOADED_CONTENT(pygobject_get(self)); - Py_UNBLOCK_THREADS; - status = g_loaded_content_analyze_and_wait(content, connect, cache); - Py_BLOCK_THREADS; - result = status ? Py_True : Py_False; Py_INCREF(result); diff --git a/plugins/pychrysalide/core/queue.c b/plugins/pychrysalide/core/queue.c index d0fbed8..febf1b0 100644 --- a/plugins/pychrysalide/core/queue.c +++ b/plugins/pychrysalide/core/queue.c @@ -63,7 +63,6 @@ static PyObject *py_queue_wait_for_all_global_works(PyObject *, PyObject *); static PyObject *py_queue_setup_global_work_group(PyObject *self, PyObject *args) { PyObject *result; /* Valeur à retourner */ - PyThreadState *_save; /* Sauvegarde de contexte */ wgroup_id_t wid; /* Identifiant de groupe */ #define QUEUE_SETUP_GLOBAL_WORK_GROUP_METHOD PYTHON_METHOD_DEF \ @@ -79,14 +78,10 @@ static PyObject *py_queue_setup_global_work_group(PyObject *self, PyObject *args " unique identifier of a work group." \ ) - Py_UNBLOCK_THREADS; - wid = setup_global_work_group(); result = PyLong_FromUnsignedLongLong(wid); - Py_BLOCK_THREADS; - return result; } @@ -109,8 +104,6 @@ static PyObject *py_queue_setup_tiny_global_work_group(PyObject *self, PyObject { PyObject *result; /* Valeur à retourner */ unsigned int count; /* Nombre de thread parallèle */ - PyThreadState *_save; /* Sauvegarde de contexte */ - int ret; /* Bilan de lecture des args. */ wgroup_id_t wid; /* Identifiant de groupe */ @@ -131,8 +124,6 @@ static PyObject *py_queue_setup_tiny_global_work_group(PyObject *self, PyObject count = 1; - Py_UNBLOCK_THREADS; - ret = PyArg_ParseTuple(args, "|I", &count); if (!ret) goto exit; @@ -148,8 +139,6 @@ static PyObject *py_queue_setup_tiny_global_work_group(PyObject *self, PyObject exit: - Py_BLOCK_THREADS; - return result; } @@ -170,8 +159,6 @@ static PyObject *py_queue_setup_tiny_global_work_group(PyObject *self, PyObject static PyObject *py_queue_wait_for_all_global_works(PyObject *self, PyObject *args) { - PyThreadState *_save; /* Sauvegarde de contexte */ - #define QUEUE_WAIT_FOR_ALL_GLOBAL_WORKS_METHOD PYTHON_METHOD_DEF \ ( \ wait_for_all_global_works, "", \ @@ -179,12 +166,8 @@ static PyObject *py_queue_wait_for_all_global_works(PyObject *self, PyObject *ar "Wait for all global tasks being processed." \ ) - Py_UNBLOCK_THREADS; - wait_for_all_global_works(); - Py_BLOCK_THREADS; - Py_RETURN_NONE; } -- cgit v0.11.2-87-g4458