Open beantowel opened 4 weeks ago
2.12.0
py::gil_scoped_acquire shall be ok to be used in cpp threads, but the example code would crush (access violation) when calling foo.test().
py::gil_scoped_acquire
foo.test()
#include "pybind11/gil.h" #include "pybind11/pybind11.h" #include <stdio.h> #include <thread> namespace py = pybind11; void test() { printf("acquire gil\n"); py::gil_scoped_acquire acquire; // ok here std::thread([](){ printf("acquire gil in new thread\n"); py::gil_scoped_acquire acquire; // crush here }).join(); printf("exit test\n"); } PYBIND11_MODULE(foo, m) { m.def("test", &test); }
Not a regression
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.12.0
Problem description
py::gil_scoped_acquire
shall be ok to be used in cpp threads, but the example code would crush (access violation) when callingfoo.test()
.Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression