Salome HOME
[EDF30399] : Steer directory hosting replay files
[modules/kernel.git] / src / Container / SALOME_CPythonHelper.cxx
index f19a05f88c5db829f121810cc6f9d803676b7d04..8fae563f3a251b60c975a7c64ed90f0ec566db8c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2019-2024  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -77,6 +77,14 @@ void SALOME_CPythonHelper::initializePython(int argc, char *argv[])
   PyDict_SetItemString(_globals,"socket",socket);
 }
 
+void SALOME_CPythonHelper::allowPythonCallsFromDifferentThread() const
+{
+#if PY_VERSION_HEX < 0x03070000
+  PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
+#endif
+  PyEval_SaveThread(); /* Release the thread state */
+}
+
 void SALOME_CPythonHelper::registerToSalomePiDict(const std::string& processName, long pid) const
 {
   AutoGIL agil;