1. python GIL锁
如果c++线程回收的时候被卡死,需要在线程join()前释放GIL锁,如:
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
namespace py = pybind11;
py::gil_scoped_release release;
printf("gil scoped release ...\n");
this->outputThread.join();
注意:py::gil_scoped_release 变量的作用域要保证join()完成,如:
{
py::gil_scoped_release release;
printf("gil scoped release ...\n");
this->outputThread.join();
}