# What happens to a block as wait() finishes?

**URL:** <https://www.ruby-forum.com/t/what-happens-to-a-block-as-wait-finishes/192604>\
**Category:** GNU Radio\
**Created:** [August 2, 2010, 10:19pm UTC](https://www.ruby-forum.com/t/what-happens-to-a-block-as-wait-finishes/192604 "2010-08-02T22:19:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [August 2, 2010, 10:19pm UTC](https://www.ruby-forum.com/t/what-happens-to-a-block-as-wait-finishes/192604/1 "2010-08-02T22:19:00Z")

</div>

Hello,

I’m just wondering, what happens within block code when whatever shuts  
down  
the graph after the gr\_top\_block.wait() executes? Is there condition  
detectable from within a block which could be used to run some code when  
the  
block pauses? I want to copy the remaining input buffer into an internal  
memory buffer to fix a problem I’m getting with the FIR block over a  
wait()  
run() cycle.

Also I’m guessing that I can overload the gr\_block.start() function  
within a  
custom block declaration to copy this buffer back to the input buffer  
somehow?

Cheers,

John

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [August 2, 2010, 11:29pm UTC](https://www.ruby-forum.com/t/what-happens-to-a-block-as-wait-finishes/192604/2 "2010-08-02T23:29:49Z")

</div>

On Mon, Aug 02, 2010 at 09:16:03PM +0100, John W. wrote:

> Hello,
> 
> I’m just wondering, what happens within block code when whatever shuts down  
> the graph after the gr\_top\_block.wait() executes? Is there condition  
> detectable from within a block which could be used to run some code when the  
> block pauses?

Nope. The block (at least the user code) doesn’t know it’s done.

> I want to copy the remaining input buffer into an internal  
> memory buffer to fix a problem I’m getting with the FIR block over a wait()  
> run() cycle.

I think the easiest way to handle this is to write a new FIR block  
that does _exactly_ what you want. If you need to add a new ‘please  
stash the delay line now’ method, just add it, then call it when you  
like.

> Also I’m guessing that I can overload the gr\_block.start() function within a  
> custom block declaration to copy this buffer back to the input buffer  
> somehow?

Those are not the hooks you’re looking for.

Eric
