diff options
author | jcorgan | 2006-12-14 23:37:20 +0000 |
---|---|---|
committer | jcorgan | 2006-12-14 23:37:20 +0000 |
commit | 3ffcee6b999a5ec8a1e59c0a26cd8f3bc7725dfc (patch) | |
tree | 3201ea7128f16d823369205c329312d1b0e5b51a /gnuradio-core/src/lib/runtime/gr_runtime.i | |
parent | eabd80cc159a8532952f6c23789d89b19066c35c (diff) | |
download | gnuradio-3ffcee6b999a5ec8a1e59c0a26cd8f3bc7725dfc.tar.gz gnuradio-3ffcee6b999a5ec8a1e59c0a26cd8f3bc7725dfc.tar.bz2 gnuradio-3ffcee6b999a5ec8a1e59c0a26cd8f3bc7725dfc.zip |
Merge jcorgan/sfg changeset 4089 into trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@4090 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src/lib/runtime/gr_runtime.i')
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_runtime.i | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_runtime.i b/gnuradio-core/src/lib/runtime/gr_runtime.i index 2933c7187..3a8b7e0b6 100644 --- a/gnuradio-core/src/lib/runtime/gr_runtime.i +++ b/gnuradio-core/src/lib/runtime/gr_runtime.i @@ -37,3 +37,39 @@ public: void stop() throw (std::runtime_error); void wait() throw (std::runtime_error); }; + +%{ +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 runtime_run_unlocked(gr_runtime_sptr r) throw (std::runtime_error) +{ + ensure_py_gil_state2 _lock; + r->run(); +} + +void runtime_start_unlocked(gr_runtime_sptr r) throw (std::runtime_error) +{ + ensure_py_gil_state2 _lock; + r->start(); +} + +void runtime_stop_unlocked(gr_runtime_sptr r) throw (std::runtime_error) +{ + ensure_py_gil_state2 _lock; + r->stop(); +} + +void runtime_wait_unlocked(gr_runtime_sptr r) throw (std::runtime_error) +{ + ensure_py_gil_state2 _lock; + r->wait(); +} + +%} |