summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/top_block.py7
-rw-r--r--gnuradio-runtime/swig/top_block.i30
2 files changed, 28 insertions, 9 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/top_block.py b/gnuradio-runtime/python/gnuradio/gr/top_block.py
index 944e95e5ae..e4d1f4194a 100644
--- a/gnuradio-runtime/python/gnuradio/gr/top_block.py
+++ b/gnuradio-runtime/python/gnuradio/gr/top_block.py
@@ -20,7 +20,8 @@
#
from runtime_swig import top_block_swig, \
- top_block_wait_unlocked, top_block_run_unlocked
+ top_block_wait_unlocked, top_block_run_unlocked, \
+ top_block_start_unlocked, top_block_stop_unlocked
#import gnuradio.gr.gr_threading as _threading
import gr_threading as _threading
@@ -99,10 +100,10 @@ class top_block(object):
return getattr(self._tb, name)
def start(self, max_noutput_items=10000000):
- self._tb.start(max_noutput_items)
+ top_block_start_unlocked(self._tb, max_noutput_items)
def stop(self):
- self._tb.stop()
+ top_block_stop_unlocked(self._tb)
def run(self, max_noutput_items=10000000):
self.start(max_noutput_items)
diff --git a/gnuradio-runtime/swig/top_block.i b/gnuradio-runtime/swig/top_block.i
index 7639403393..f5c5819ab9 100644
--- a/gnuradio-runtime/swig/top_block.i
+++ b/gnuradio-runtime/swig/top_block.i
@@ -58,16 +58,34 @@ namespace gr {
%inline %{
void top_block_run_unlocked(gr::top_block_sptr r) throw (std::runtime_error)
{
- Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
- r->run();
- Py_END_ALLOW_THREADS; // acquire global interpreter lock
+ GR_PYTHON_BLOCKING_CODE
+ (
+ r->run();
+ )
+}
+
+void top_block_start_unlocked(gr::top_block_sptr r, int max_noutput_items) throw (std::runtime_error)
+{
+ GR_PYTHON_BLOCKING_CODE
+ (
+ r->start(max_noutput_items);
+ )
}
void top_block_wait_unlocked(gr::top_block_sptr r) throw (std::runtime_error)
{
- Py_BEGIN_ALLOW_THREADS; // release global interpreter lock
- r->wait();
- Py_END_ALLOW_THREADS; // acquire global interpreter lock
+ GR_PYTHON_BLOCKING_CODE
+ (
+ r->wait();
+ )
+}
+
+void top_block_stop_unlocked(gr::top_block_sptr r) throw (std::runtime_error)
+{
+ GR_PYTHON_BLOCKING_CODE
+ (
+ r->stop();
+ )
}
%}