Prevent link errors when the python library is compiled without support

for threads.
L521-010 and L522-013

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@189889 936e1b1b-40f2-da11-902a-00137254ae57
This commit is contained in:
Emmanuel Briot
2012-05-22 10:34:49 +00:00
parent 63fdcdf691
commit a4bd6fffd2
3 changed files with 59 additions and 5 deletions

View File

@@ -488,3 +488,45 @@ ada_pydescr_newGetSet (PyTypeObject* type,
return 1;
}
}
#ifdef WITH_THREAD
const int python_with_thread = 1;
#else
const int python_with_thread = 0;
#endif
PyThreadState* ada_PyEval_SaveThread() {
#ifdef WITH_THREAD
return PyEval_SaveThread();
#else
return NULL;
#endif
}
void ada_PyEval_RestoreThread (PyThreadState* state) {
#ifdef WITH_THREAD
PyEval_RestoreThread (state);
#endif
}
PyThreadState* ada_PyGILState_GetThisThreadState() {
#ifdef WITH_THREAD
return PyGILState_GetThisThreadState();
#else
return NULL;
#endif
}
int ada_PyGILState_Ensure() {
#ifdef WITH_THREAD
return PyGILState_Ensure();
#else
return 0;
#endif
}
void ada_PyEval_InitThreads() {
#ifdef WITH_THREAD
PyEval_InitThreads();
#endif
}