Fix releasing GIL (#741)
This commit is contained in:
@@ -53,17 +53,8 @@ void PybindOfflineStream(py::module *m) {
|
|||||||
py::class_<PyClass>(*m, "OfflineStream")
|
py::class_<PyClass>(*m, "OfflineStream")
|
||||||
.def(
|
.def(
|
||||||
"accept_waveform",
|
"accept_waveform",
|
||||||
[](PyClass &self, float sample_rate, py::array_t<float> waveform) {
|
[](PyClass &self, float sample_rate,
|
||||||
#if 0
|
const std::vector<float> &waveform) {
|
||||||
auto report_gil_status = []() {
|
|
||||||
auto is_gil_held = false;
|
|
||||||
if (auto tstate = py::detail::get_thread_state_unchecked())
|
|
||||||
is_gil_held = (tstate == PyGILState_GetThisThreadState());
|
|
||||||
|
|
||||||
return is_gil_held ? "GIL held" : "GIL released";
|
|
||||||
};
|
|
||||||
std::cout << report_gil_status() << "\n";
|
|
||||||
#endif
|
|
||||||
self.AcceptWaveform(sample_rate, waveform.data(), waveform.size());
|
self.AcceptWaveform(sample_rate, waveform.data(), waveform.size());
|
||||||
},
|
},
|
||||||
py::arg("sample_rate"), py::arg("waveform"), kAcceptWaveformUsage,
|
py::arg("sample_rate"), py::arg("waveform"), kAcceptWaveformUsage,
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ void PybindOnlineStream(py::module *m) {
|
|||||||
py::class_<PyClass>(*m, "OnlineStream")
|
py::class_<PyClass>(*m, "OnlineStream")
|
||||||
.def(
|
.def(
|
||||||
"accept_waveform",
|
"accept_waveform",
|
||||||
[](PyClass &self, float sample_rate, py::array_t<float> waveform) {
|
[](PyClass &self, float sample_rate,
|
||||||
|
const std::vector<float> &waveform) {
|
||||||
self.AcceptWaveform(sample_rate, waveform.data(), waveform.size());
|
self.AcceptWaveform(sample_rate, waveform.data(), waveform.size());
|
||||||
},
|
},
|
||||||
py::arg("sample_rate"), py::arg("waveform"), kAcceptWaveformUsage,
|
py::arg("sample_rate"), py::arg("waveform"), kAcceptWaveformUsage,
|
||||||
|
|||||||
Reference in New Issue
Block a user