# GnuRadio flowgraphs in workerthread

**URL:** <https://www.ruby-forum.com/t/gnuradio-flowgraphs-in-workerthread/236928>\
**Category:** GNU Radio\
**Created:** [October 11, 2013, 4:53pm UTC](https://www.ruby-forum.com/t/gnuradio-flowgraphs-in-workerthread/236928 "2013-10-11T16:53:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [October 11, 2013, 4:53pm UTC](https://www.ruby-forum.com/t/gnuradio-flowgraphs-in-workerthread/236928/1 "2013-10-11T16:53:43Z")

</div>

Hello guys,

would it affect the performance of my GNURadio-programm negatively if I  
tried to run my GNURadio flowgraphs in a workerthread instead of the  
mainthread. In the mainthread I would like to implement a custom  
wxPython  
GUI.

Also, I still do not understand what the happens when I call wait()  
and/or  
stop(). I have two flowgraphs, one for receiving and one for  
transmitting  
with the USRP2. Both use a gr.head block and run to completion after  
they  
have proccessed a certain ammount of samples. I did some testing and it  
seems to work fine. But still I would like to know if the following  
lines of  
Code make any sense:

main():

receiver = receiver\_class()

transmitter = transmitter\_class()

while(1):

\_\_\_\_\_\_receiver.run()  
\_\_\_\_\_\_transmitter.run()  
\_\_\_\_\_\_# reset the head blocks and some other stuff:  
\_\_\_\_\_\_update\_attributes()

Can I use run() OR should I use start() + wait() OR start(), wait() +  
stop()  
?

Regards  
Alex Peterson

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/GnuRadio-flowgraphs-in-workerthread-tp44121.html](http://gnuradio.4.n7.nabble.com/GnuRadio-flowgraphs-in-workerthread-tp44121.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Alex3371](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@Alex3371](https://www.ruby-forum.com/u/Alex3371)\
**Post date:** [October 11, 2013, 7:32pm UTC](https://www.ruby-forum.com/t/gnuradio-flowgraphs-in-workerthread/236928/2 "2013-10-11T19:32:07Z")

</div>

* * *

Discuss-gnuradio mailing list  
removed\_email\_address@domain.invalid  
[https://lists.gnu.org/mailman/listinfo/discuss-gnuradio](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

---

<div class="post-metadata">

**Author:** ![Alex3371](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@Alex3371](https://www.ruby-forum.com/u/Alex3371)\
**Post date:** [October 11, 2013, 8:49pm UTC](https://www.ruby-forum.com/t/gnuradio-flowgraphs-in-workerthread/236928/3 "2013-10-11T20:49:17Z")

</div>

Wow, thank you for your detailed answer.

But one thing I don’t understand:

" If you called run() on the first one, it would not  
return from that call until the flowgraph exited, and your second  
flowgraph would get started too late. "

I don’t want the flowgraphs to run parallel to each other. One flowgraph  
senses the spectrum with the USRP and the second flowgraph transmitts a  
signal with the same USRP (depending on the measurements of the  
spectrum).  
So it’s important that they run consecutively.

In this case, is it fine the way I do call run() for both flowgraphs?  
Would  
replacing it with start() + wait() make any difference?

Also, I hope you don’t mind if I add one more questions:

When the flowgraph is stopped by a head-block the threads are shutdown,  
but  
the flowgraph itself still exists with all the blockinternal member  
variables (including possible changes during the first run) and after a  
head-reset it can be re-run with the run()-method. This re-run starts  
where  
the previous run stopped. Is that correct?

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/GnuRadio-flowgraphs-in-workerthread-tp44121p44131.html](http://gnuradio.4.n7.nabble.com/GnuRadio-flowgraphs-in-workerthread-tp44121p44131.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Alex3371](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@Alex3371](https://www.ruby-forum.com/u/Alex3371)\
**Post date:** [October 11, 2013, 9:33pm UTC](https://www.ruby-forum.com/t/gnuradio-flowgraphs-in-workerthread/236928/4 "2013-10-11T21:33:42Z")

</div>

* * *

Discuss-gnuradio mailing list  
removed\_email\_address@domain.invalid  
[https://lists.gnu.org/mailman/listinfo/discuss-gnuradio](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)
