diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-03-13 14:34:50 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-03-13 14:34:50 -0400 |
commit | 1c33a22e92654bb8333fcd0360414a514e6927f8 (patch) | |
tree | 352d1dfe9a726fb453144524dd1621f1a36d471c /gr-blocks/lib/message_strobe_impl.cc | |
parent | 13cf0ce205bfc986e462591764cb7ca16e21346c (diff) |
blocks: message strobe shutdown fix.
On embedded systems, this block's destructure was not getting called
in the right order and the flowgraph would hang because this block's
thread running run would never quit. Moving the start and stop
handling of this thread to the start/stop functions of the block fix
this. Also makes sure that the block is only producing messages when
the flowgraph is running.
Diffstat (limited to 'gr-blocks/lib/message_strobe_impl.cc')
-rw-r--r-- | gr-blocks/lib/message_strobe_impl.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gr-blocks/lib/message_strobe_impl.cc b/gr-blocks/lib/message_strobe_impl.cc index b3f1782229..ae13808674 100644 --- a/gr-blocks/lib/message_strobe_impl.cc +++ b/gr-blocks/lib/message_strobe_impl.cc @@ -54,8 +54,6 @@ namespace gr { d_msg(msg) { message_port_register_out(pmt::mp("strobe")); - d_thread = boost::shared_ptr<gr::thread::thread> - (new gr::thread::thread(boost::bind(&message_strobe_impl::run, this))); message_port_register_in(pmt::mp("set_msg")); set_msg_handler(pmt::mp("set_msg"), @@ -64,9 +62,26 @@ namespace gr { message_strobe_impl::~message_strobe_impl() { + } + + bool + message_strobe_impl::start() + { + d_thread = boost::shared_ptr<gr::thread::thread> + (new gr::thread::thread(boost::bind(&message_strobe_impl::run, this))); + + return block::start(); + } + + bool + message_strobe_impl::stop() + { + // Shut down the thread d_finished = true; d_thread->interrupt(); d_thread->join(); + + return block::stop(); } void message_strobe_impl::run() |