discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Muliple top_block()


From: Johnathan Corgan
Subject: Re: [Discuss-gnuradio] Muliple top_block()
Date: Mon, 20 Jun 2011 09:40:41 -0700

On Mon, Jun 20, 2011 at 03:59, Mike Clark <address@hidden> wrote:
 
try tb1.start() and tb2.start(). That should run them in separate threads.

The start() function kicks off the GNU Radio thread scheduler for a flowgraph top block, but immediately returns to the foreground thread.  You'll be able to do other things in your application while GNU Radio runs "in the background."  Typically this is used even for a single top block in GUI programs to start GNU Radio running and then enter the GUI library event loop in the foreground thread.

However, you'll need at some point to call tb1.stop(), tb2.stop(), tb1.wait(), tb2.wait() before the program exits, in order to properly clean up GNU Radio created resources.

Finally, depending on the application, you might need to hook SIGINT so you can do the above as part of a proper shutdown if the user hits ^C or otherwise kills the process.

Martin's suggestion of placing the flowgraphs each into their own port-less hierarchical block and then putting those into a single top block makes sense if the two flowgraphs must always be started and stopped together.  It used to be the only way to do it, but as of 3.3 you could run multiple, independent top blocks in a single process via the start()/stop()/wait() sequence on each instead of run().

Johnathan

reply via email to

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