summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block.i15
1 files changed, 4 insertions, 11 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.i b/gnuradio-core/src/lib/runtime/gr_top_block.i
index 78c2e0b95..4eb9db636 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_top_block.i
@@ -49,25 +49,18 @@ public:
bool is_running();
};
-%{
-class ensure_py_gil_state2 {
- PyGILState_STATE d_gstate;
-public:
- ensure_py_gil_state2() { d_gstate = PyGILState_Ensure(); }
- ~ensure_py_gil_state2() { PyGILState_Release(d_gstate); }
-};
-%}
-
%inline %{
void top_block_run_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
{
- ensure_py_gil_state2 _lock;
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
r->run();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
}
void top_block_wait_unlocked(gr_top_block_sptr r) throw (std::runtime_error)
{
- ensure_py_gil_state2 _lock;
+ Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
r->wait();
+ Py_END_ALLOW_THREADS; // acquire global interpreter lock
}
%}