forked from huawei/mindspore2022
fix serving gil
Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
parent
0b1ec574cf
commit
dc2633df03
|
|
@ -28,7 +28,11 @@ namespace py = pybind11;
|
|||
namespace mindspore {
|
||||
class GilScopedLongRunningHook : public ScopedLongRunningHook {
|
||||
public:
|
||||
void Enter() override { release_ = std::make_unique<py::gil_scoped_release>(); }
|
||||
void Enter() override {
|
||||
if (PyGILState_Check() != 0) {
|
||||
release_ = std::make_unique<py::gil_scoped_release>();
|
||||
}
|
||||
}
|
||||
void Leave() override { release_ = nullptr; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in New Issue