# "Catching" end of flowgraph execution with GUI

**URL:** <https://www.ruby-forum.com/t/catching-end-of-flowgraph-execution-with-gui/241846>\
**Category:** GNU Radio\
**Created:** [May 5, 2015, 2:01pm UTC](https://www.ruby-forum.com/t/catching-end-of-flowgraph-execution-with-gui/241846 "2015-05-05T14:01:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [May 5, 2015, 2:01pm UTC](https://www.ruby-forum.com/t/catching-end-of-flowgraph-execution-with-gui/241846/1 "2015-05-05T14:01:57Z")

</div>

Hi all (again),

is there any way to catch that my flowgraph has finished execution, to  
reconfigure it after that and to be able to watch signals in GUI?

In my application I I would like to set some start and end values and to  
press some kind of start button. After that flowgraph runs for the first  
set of config parameters and after the execution is finished, it should  
reconfigure itself and restart it for the second set of parameters, and  
so  
on … Meanwhile I would like to watch some signals in GUI.

I see that top\_block\_gui class calls infinite main loop and then it  
blocks  
there. I suppose that in order to acomplish above stated tast, I would  
need  
some kind of callback on flowgraph execution end. Is it possible to make  
something like this?

Thanx,

---

<div class="post-metadata">

**Author:** ![Nemanja\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@Nemanja\_S](https://www.ruby-forum.com/u/Nemanja_S)\
**Post date:** [May 5, 2015, 5:24pm UTC](https://www.ruby-forum.com/t/catching-end-of-flowgraph-execution-with-gui/241846/2 "2015-05-05T17:24:40Z")

</div>

Hi Nemanja,  
typically, clicking your “start” button would spawn a new thread, in  
which you top\_block.start(), .stop() and .wait(); after wait returns,  
you would then use whatever multithreading framework you’re using to  
notify the threads that need to know.  
GNU Radio is not very callback-oriented, i.e. there’s no “hooks” in the  
scheduler – typically, you use “active” things like message passing to  
hand information around.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![Nemanja\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@Nemanja\_S](https://www.ruby-forum.com/u/Nemanja_S)\
**Post date:** [May 5, 2015, 8:11pm UTC](https://www.ruby-forum.com/t/catching-end-of-flowgraph-execution-with-gui/241846/3 "2015-05-05T20:11:46Z")

</div>

I had a similar problem recently. My solution was to subclass the  
flowgraph adding the required functionality. Check out the  
\_top\_block\_waiter class in top\_block.py. You can reimplement that logic  
to e.g. add a time-out the the wait() call on the event or have a  
callback executed.

Sebastian

On 05/05/2015 02:00 PM, Nemanja S. wrote:

> in GUI.
> 
> I see that top\_block\_gui class calls infinite main loop and then it  
> blocks there. I suppose that in order to acomplish above stated tast,  
> I would need some kind of callback on flowgraph execution end. Is it  
> possible to make something like this?
> 
> Thanx,
> 
> –  
> Nemanja Savić

–  
Karlsruhe Institute of Technology (KIT)  
Communications Engineering Lab (CEL)

Dipl.-Ing. Sebastian Koslowski  
Research Associate

Kaiserstraße 12  
Building 05.01  
76131 Karlsruhe, Germany

Phone: +49 721 608-46275  
Fax: +49 721 608-46071  
Email: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Web: [http://www.cel.kit.edu/](http://www.cel.kit.edu/)

KIT – University of the State of Baden-Wuerttemberg and National  
Research Center of the Helmholtz Association

---

<div class="post-metadata">

**Author:** ![Nemanja\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@Nemanja\_S](https://www.ruby-forum.com/u/Nemanja_S)\
**Post date:** [May 6, 2015, 11:48am UTC](https://www.ruby-forum.com/t/catching-end-of-flowgraph-execution-with-gui/241846/4 "2015-05-06T11:48:12Z")

</div>

Hi all guys,

I understand more or less what you are suggesting, although I am not  
familiar with any multithreading framework, but at least I could ask  
somebody here in the house. The problem is following, as I described in  
my  
other (recent :)) posts:

I have top block which consists of two flowgraphs, ie. tx path and rx  
path.  
Tx path transmitts limited number of frames and then stops, but RX  
continues to work, which means that top block will also never stop. I  
want  
to be able to stop also RX path after the TX has finished. For this  
reason  
I don’t know how to catch that TX has finished and to proceed with  
stopping  
RX.

Best and thanx,  
Nemanja

On Tue, May 5, 2015 at 8:10 PM, Koslowski, Sebastian (CEL) \<
