This commit is contained in:
Felipe Lema 2016-01-25 16:22:44 -03:00
parent 15f6a0030e
commit 2019f0c9f5

View File

@ -983,13 +983,30 @@ template <typename InputType, typename OutputType> void implicitly_convertible()
((detail::type_info *) it->second)->implicit_conversions.push_back(implicit_caster);
}
inline void init_threading() { PyEval_InitThreads(); }
inline void init_threading() {
#if defined(WITH_THREAD)
PyEval_InitThreads();
#endif
}
class gil_scoped_acquire {
#if defined(WITH_THREAD)
PyGILState_STATE state;
#endif
public:
inline gil_scoped_acquire() { state = PyGILState_Ensure(); }
inline ~gil_scoped_acquire() { PyGILState_Release(state); }
inline gil_scoped_acquire() {
#if defined(WITH_THREAD)
state = PyGILState_Ensure();
#endif
}
inline ~gil_scoped_acquire() {
#if defined(WITH_THREAD)
PyGILState_Release(state);
#endif
}
#if defined(WITH_THREAD)
PyEval_InitThreads();
#endif
};
class gil_scoped_release {