From: Anthony Geay Date: Wed, 25 Sep 2019 08:17:27 +0000 (+0200) Subject: Reduce critical section X-Git-Tag: V9_4_0~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9915f42abfeaebcefceec3ec524dc2b5e037161f;p=tools%2Fadao_interface.git Reduce critical section --- 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);