summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2013-06-22 09:53:23 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2013-06-22 09:53:23 -0700
commit5b507f3831afcffc1ee147fe22c31af95b9a7596 (patch)
tree08ce238f4c0c0915b80582442913cde4fb5b58bf
parentb902e405e4c2eb4e6ffd4c944d6fcac13b7526df (diff)
core: ensure message passing blocks marked done are handled
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
index 679fd15124..b42563d806 100644
--- a/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
+++ b/gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
@@ -99,20 +99,25 @@ gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block, int max_noutput_item
{
gruel::scoped_lock guard(d->d_tpb.mutex);
while (!d->d_tpb.input_changed){
-
+
// wait for input or message
while(!d->d_tpb.input_changed && block->empty_p())
d->d_tpb.input_cond.wait(guard);
-
+
// handle all pending messages
- BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue )
- {
- while ((msg = block->delete_head_nowait(i.first))){
- guard.unlock(); // release lock while processing msg
- block->dispatch_msg(i.first, msg);
- guard.lock();
+ BOOST_FOREACH( gr_basic_block::msg_queue_map_t::value_type &i, block->msg_queue )
+ {
+ while ((msg = block->delete_head_nowait(i.first))){
+ guard.unlock(); // release lock while processing msg
+ block->dispatch_msg(i.first, msg);
+ guard.lock();
+ }
}
- }
+
+ if (d->done()) {
+ return;
+
+ }
}
}
break;