From 6b1dcc7d74acf86d755de4668ad7b136ed3748be Mon Sep 17 00:00:00 2001 From: jcorgan Date: Fri, 2 Nov 2007 03:02:56 +0000 Subject: Merged r6780:6781 from jcorgan/t196. Fixes ticket:196. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6782 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/runtime/gr_top_block.i | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'gnuradio-core/src') 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 } %} -- cgit