From 9915f42abfeaebcefceec3ec524dc2b5e037161f Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 25 Sep 2019 10:17:27 +0200 Subject: [PATCH] Reduce critical section --- AdaoExchangeLayer.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/AdaoExchangeLayer.cxx b/AdaoExchangeLayer.cxx index 9a101a4..a478bf0 100644 --- a/AdaoExchangeLayer.cxx +++ b/AdaoExchangeLayer.cxx @@ -321,10 +321,12 @@ void AdaoExchangeLayer::loadTemplate(AdaoModel::MainModel *model) void ExecuteAsync(PyObject *pyExecuteFunction, DataExchangedBetweenThreads *data) { - AutoGIL gil; // launched in a separed thread -> protect python calls - PyObjectRAII args(PyObjectRAII::FromNew(PyTuple_New(0))); - PyObjectRAII nullRes(PyObjectRAII::FromNew(PyObject_CallObject(pyExecuteFunction,args)));// go to adaocallback_call - PyErr_Print(); + { + AutoGIL gil; // launched in a separed thread -> protect python calls + PyObjectRAII args(PyObjectRAII::FromNew(PyTuple_New(0))); + PyObjectRAII nullRes(PyObjectRAII::FromNew(PyObject_CallObject(pyExecuteFunction,args)));// go to adaocallback_call + PyErr_Print(); + } data->_finished = true; data->_data = nullptr; sem_post(&data->_sem); -- 2.39.2