diff options
Diffstat (limited to 'gnuradio-runtime/lib/block_executor.cc')
-rw-r--r-- | gnuradio-runtime/lib/block_executor.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc index 85cf4bb2ab..ee22ef55e3 100644 --- a/gnuradio-runtime/lib/block_executor.cc +++ b/gnuradio-runtime/lib/block_executor.cc @@ -451,16 +451,12 @@ namespace gr { m->set_is_unaligned(m->unaligned() != 0); } - if(n == block::WORK_DONE) - goto were_done; - - if(n != block::WORK_CALLED_PRODUCE) - d->produce_each (n); // advance write pointers - - // Wait til after we've consumed and produced and recalculate - // the relative rate. - if(!d->sink_p() && !d->source_p()) { - rrate = ((double)m->nitems_written(0)) / ((double)m->nitems_read(0)); + // For some blocks that can change their produce/consume ratio + // (the relative_rate), we might want to automatically update + // based on the amount of items written/read. + // In the block constructor, use enable_update_rate(true). + if(m->update_rate()) { + rrate = ((double)(m->nitems_written(0)+n)) / ((double)m->nitems_read(0)); if(rrate > 0) m->set_relative_rate(rrate); } @@ -471,8 +467,13 @@ namespace gr { d_returned_tags, m->unique_id())) goto were_done; + if(n == block::WORK_DONE) + goto were_done; + + if(n != block::WORK_CALLED_PRODUCE) + d->produce_each(n); // advance write pointers - if(d->d_produce_or > 0) // block produced something + if(d->d_produce_or > 0) // block produced something return READY; // We didn't produce any output even though we called general_work. |