mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Solves #81
This commit is contained in:
parent
15f6a0030e
commit
2019f0c9f5
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user