Release GIL to support multithreading in websocket servers. (#451)

This commit is contained in:
Fangjun Kuang
2023-11-27 13:44:03 +08:00
committed by GitHub
parent 8dc08a9b97
commit 87a47d7db4
10 changed files with 87 additions and 47 deletions

View File

@@ -28,8 +28,10 @@ void PybindOnlineStream(py::module *m) {
[](PyClass &self, float sample_rate, py::array_t<float> waveform) {
self.AcceptWaveform(sample_rate, waveform.data(), waveform.size());
},
py::arg("sample_rate"), py::arg("waveform"), kAcceptWaveformUsage)
.def("input_finished", &PyClass::InputFinished);
py::arg("sample_rate"), py::arg("waveform"), kAcceptWaveformUsage,
py::call_guard<py::gil_scoped_release>())
.def("input_finished", &PyClass::InputFinished,
py::call_guard<py::gil_scoped_release>());
}
} // namespace sherpa_onnx