discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Calling produce()/consume() multiple times


From: Michael Dickens
Subject: Re: [Discuss-gnuradio] Calling produce()/consume() multiple times
Date: Sun, 19 Nov 2017 13:16:14 -0500

You can safely call produce() and consume() multiple times in the same
work() call: yes!

Note that by doing so, if you're using the nitems_written() or
nitems_read() [e.g., for finding or writing tags], then those values
will be updated when you call produce() and consume() -BUT- inside the
work() method of your block, you will have to keep track of the I/O data
pointers yourself.

Hope this helps! - MLD

On Sun, Nov 19, 2017, at 11:37 AM, schneider wrote:
> On 19/11/17 17:22, rear1019 wrote:
> 
> > I have a question regarding the usage of produce() and consume(): Is it
> > safe to call these functions multiple times? Or must the calls be
> > merged into a single one?
> 
> consume() in the end calls buffer_reader::update_read_pointer(int
> nitems) which again calls index_add()
> 
> Looking at the code I'd say consume(a+b) is equivalent to consume(a) +
> consume(b).
> 
> You can find the source for these things in the gnuradio-runtime/
> directory. It is pretty straight forward code. I'll leave produce() as
> an exercise for you ;)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]