diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2020-11-12 18:21:14 +0100 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2020-12-17 08:08:38 -0500 |
commit | 36654e9068930f973112b90ac48e62a749cefcfc (patch) | |
tree | 114fa91b605b1407ea33f97cbeac00b3574b75aa /gnuradio-runtime/python/gnuradio | |
parent | 91a9a86d846800ca810d1b690b726ae6466d25fd (diff) |
move msgq_runner out of runtime into gr-uhd/apps, its single consumer
Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
Diffstat (limited to 'gnuradio-runtime/python/gnuradio')
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gru/__init__.py | 1 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/gru/msgq_runner.py | 70 |
3 files changed, 0 insertions, 72 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt index a122da0930..123cf8c34e 100644 --- a/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/gru/CMakeLists.txt @@ -9,6 +9,5 @@ include(GrPython) GR_PYTHON_INSTALL(FILES __init__.py - msgq_runner.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/gru ) diff --git a/gnuradio-runtime/python/gnuradio/gru/__init__.py b/gnuradio-runtime/python/gnuradio/gru/__init__.py index 8443f1a4fd..0857b0302b 100644 --- a/gnuradio-runtime/python/gnuradio/gru/__init__.py +++ b/gnuradio-runtime/python/gnuradio/gru/__init__.py @@ -1,4 +1,3 @@ # make this a package # Import gru stuff -from .msgq_runner import * diff --git a/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py b/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py deleted file mode 100644 index 31bebcf0df..0000000000 --- a/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# SPDX-License-Identifier: GPL-3.0-or-later -# -# - -""" -Convenience class for dequeuing messages from a gr.msg_queue and -invoking a callback. - -Creates a Python thread that does a blocking read on the supplied -gr.msg_queue, then invokes callback each time a msg is received. - -If the msg type is not 0, then it is treated as a signal to exit -its loop. - -If the callback raises an exception, and the runner was created -with 'exit_on_error' equal to True, then the runner will store the -exception and exit its loop, otherwise the exception is ignored. - -To get the exception that the callback raised, if any, call -exit_error() on the object. - -To manually stop the runner, call stop() on the object. - -To determine if the runner has exited, call exited() on the object. -""" - -from gnuradio import gr -import threading - -class msgq_runner(threading.Thread): - - def __init__(self, msgq, callback, exit_on_error=False): - threading.Thread.__init__(self) - - self._msgq = msgq - self._callback = callback - self._exit_on_error = exit_on_error - self._done = False - self._exited = False - self._exit_error = None - self.setDaemon(1) - self.start() - - def run(self): - while not self._done: - msg = self._msgq.delete_head() - if msg.type() != 0: - self.stop() - else: - try: - self._callback(msg) - except Exception as e: - if self._exit_on_error: - self._exit_error = e - self.stop() - self._exited = True - - def stop(self): - self._done = True - - def exited(self): - return self._exited - - def exit_error(self): - return self._exit_error |