Преглед на файлове

Use Py_IsInitialized() instead of PyEval_ThreadsInitialized()

Since PyEval_InitThreads() hasn't been called, PyEval_ThreadsInitialized()
won't return True.

Calling PyEval_InitThreads() shouldn't be call if not needed, indeed as mention
in the documentation calling this function initialize and acquire the global
interpreter lock which cause an unnecessary overhead.
Jean-Christophe Fillion-Robin преди 14 години
родител
ревизия
e93bbba8d8
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

+ 1 - 1
Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp

@@ -49,7 +49,7 @@ ctkAbstractPythonManager::ctkAbstractPythonManager(QObject* _parent) : Superclas
 //-----------------------------------------------------------------------------
 ctkAbstractPythonManager::~ctkAbstractPythonManager()
 {
-  if (PyEval_ThreadsInitialized())
+  if (Py_IsInitialized())
     {
     PyThreadState* state = PyThreadState_Get();
     Py_EndInterpreter(state);