diff options
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_buffer.cc | 42 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_buffer.h | 5 |
2 files changed, 22 insertions, 25 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc index 70d57c094..1488e92f6 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.cc +++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc @@ -162,9 +162,7 @@ gr_buffer::space_available () min_items_read = std::min(min_items_read, d_readers[i]->nitems_read()); } - for (size_t i = 0; i < d_readers.size (); i++) { - d_readers[i]->prune_tags(min_items_read); - } + prune_tags(min_items_read); // The -1 ensures that the case d_write_index == d_read_index is // unambiguous. It indicates that there is no data for the reader @@ -230,6 +228,25 @@ gr_buffer::add_item_tag(const pmt::pmt_t &tag) d_item_tags.push_back(tag); } +void +gr_buffer::prune_tags(uint64_t max_time) +{ + //gruel::scoped_lock guard(*mutex()); + + int n = 0; + uint64_t item_time; + std::deque<pmt::pmt_t>::iterator itr = d_item_tags.begin(); + + while(itr != d_item_tags.end()) { + item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); + if(item_time < max_time) { + d_item_tags.pop_front(); + n++; + } + itr++; + } +} + long gr_buffer_ncurrently_allocated () { @@ -293,25 +310,6 @@ gr_buffer_reader::get_tags_in_range(std::vector<pmt::pmt_t> &v, } } -void -gr_buffer_reader::prune_tags(uint64_t max_time) -{ - int n = 0; - uint64_t item_time; - std::deque<pmt::pmt_t>::iterator itr = d_buffer->get_tags_begin(); - - while(itr != d_buffer->get_tags_end()) { - item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0)); - if(item_time < max_time) { - d_buffer->tags_pop_front(); - n++; - } - //else - // break; - itr++; - } -} - long gr_buffer_reader_ncurrently_allocated () { diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h index 88a76fdc6..2d88c1722 100644 --- a/gnuradio-core/src/lib/runtime/gr_buffer.h +++ b/gnuradio-core/src/lib/runtime/gr_buffer.h @@ -99,9 +99,10 @@ class gr_buffer { */ void add_item_tag(const pmt::pmt_t &tag); + void prune_tags(uint64_t max_time); + std::deque<pmt::pmt_t>::iterator get_tags_begin() { return d_item_tags.begin(); } std::deque<pmt::pmt_t>::iterator get_tags_end() { return d_item_tags.end(); } - void tags_pop_front() { d_item_tags.pop_front(); } // ------------------------------------------------------------------------- @@ -263,8 +264,6 @@ class gr_buffer_reader { uint64_t abs_start, uint64_t abs_end); - void prune_tags(uint64_t max_time); - // ------------------------------------------------------------------------- private: |