# Assign to 'out' but don't 'produce' anything

**URL:** <https://www.ruby-forum.com/t/assign-to-out-but-dont-produce-anything/242455>\
**Category:** GNU Radio\
**Created:** [June 24, 2015, 9:25pm UTC](https://www.ruby-forum.com/t/assign-to-out-but-dont-produce-anything/242455 "2015-06-24T21:25:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 24, 2015, 9:25pm UTC](https://www.ruby-forum.com/t/assign-to-out-but-dont-produce-anything/242455/1 "2015-06-24T21:25:41Z")

</div>

What happens when you assign input to output in a general\_work call,  
out[ii]=in[ii], but don’t call produce? Is the stuff you dumped into  
‘out’  
lost when general\_work returns WORK\_CALLED\_PRODUCE?

My minds eye sees the out variable as a secondary local buffer for  
general\_work. You dump stuff in there while general\_work has scope, and  
transfer the contents of this buffer to the gnuradio block buffer when  
you  
call produce. Am I understanding this correctly?

v/r,  
Rich

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [June 24, 2015, 9:36pm UTC](https://www.ruby-forum.com/t/assign-to-out-but-dont-produce-anything/242455/2 "2015-06-24T21:36:12Z")

</div>

Hi Rich,

> What happens when you assign input to output in a general\_work call,  
> out[ii]=in[ii], but don’t call produce?  
> Then you’re breaking a contract!  
> GNU Radio has to rely on you only writing samples you admit that you  
> produce – otherwise, the write pointer can’t advance, and the next  
> general\_work will be offered the same buffer space again.  
> My minds eye sees the out variable as a secondary local buffer for  
> general\_work.  
> There is no local buffer! You directly work on the pseudocircular  
> buffers; everything else would introduce unnecessary copy overhead.

Best regards,  
Marcus

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [June 24, 2015, 9:39pm UTC](https://www.ruby-forum.com/t/assign-to-out-but-dont-produce-anything/242455/3 "2015-06-24T21:39:07Z")

</div>

Ah OK. So the produce function advances the buffer pointer only?

Rich

On Wed, Jun 24, 2015 at 12:35 PM, Marcus Müller  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [June 24, 2015, 11:00pm UTC](https://www.ruby-forum.com/t/assign-to-out-but-dont-produce-anything/242455/4 "2015-06-24T23:00:55Z")

</div>

pretty much; it increases the the nitems\_written counter, too.
