24 void gil_acquire() { py::gil_scoped_acquire gil; }
26 constexpr
char kModuleName[] =
"cross_module_gil_utils";
28 struct PyModuleDef moduledef = {
29 PyModuleDef_HEAD_INIT, kModuleName,
nullptr, 0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
35 PyObject *
m = PyModule_Create(&moduledef);
38 static_assert(
sizeof(&gil_acquire) ==
sizeof(
void *),
39 "Function pointer must have the same size as void*");
41 m,
"gil_acquire_funcaddr", PyLong_FromVoidPtr(reinterpret_cast<void *>(&gil_acquire)));
PYBIND11_EXPORT PyObject * PyInit_cross_module_gil_utils()