mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
[python] Patch pybind11 function to avoid deadlocks
see https://github.com/pybind/pybind11/pull/1211
This commit is contained in:
parent
95efdd212d
commit
ec3051815c
@ -1,5 +1,17 @@
|
||||
#ifdef NG_PYTHON
|
||||
|
||||
// BEGIN EVIL HACK: Patch PyThread_get_key_value inside pybind11 to avoid deadlocks
|
||||
// see https://github.com/pybind/pybind11/pull/1211
|
||||
#include <Python.h>
|
||||
#include <pythread.h>
|
||||
namespace pybind11 {
|
||||
inline void * PyThread_get_key_value(int state) {
|
||||
PyThreadState *tstate = (PyThreadState *) ::PyThread_get_key_value(state);
|
||||
if (!tstate) tstate = PyGILState_GetThisThreadState();
|
||||
return tstate;
|
||||
}
|
||||
}
|
||||
// END EVIL HACK
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/operators.h>
|
||||
namespace py = pybind11;
|
||||
|
Loading…
Reference in New Issue
Block a user