Browse Source

!31181 fix serving gil

Merge pull request !31181 from zhoufeng/fix-serving-gil
r1.7
i-robot Gitee 4 years ago
parent
commit
2fb0788d04
No known key found for this signature in database GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      mindspore/ccsrc/pybind_api/gil_scoped_long_running.h

+ 5
- 1
mindspore/ccsrc/pybind_api/gil_scoped_long_running.h View File

@@ -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…
Cancel
Save