How does a C++ custom block kill the FlowGraph

Discuss-gnuradio mailing list
[email protected]

On 10.02.2014 09:18, Tommy T. II wrote:

Dear Gnuradio Community,

I have some custom gnu radio blocks that make up my flow graph. I want
one of my blocks to kill this flow graph (cause all blocks to call their
destructors). When the source is computing its last set of inputs, I
want it to let all the other blocks know its time to stop. Ideally,
this source would finish its computation, and allow the sink block to
sink the data before stopping. How would I go about doing this?

Have your block return WORK_DONE (or -1) in the work function.

Note this doesn’t call the destructors, though! They get called when
your blocks go out of scope. It makes blocks call their stop(), though.


Discuss-gnuradio mailing list
[email protected]

On 02/21/2014 06:27 PM, Tommy T. II wrote:

Both sub-flowgraphs use the same top block (you cant have two top
blocks in one application). Unfortunately, because they are disjoint, if
the 1st Source returns WORK_DONE, it wont call the other blocks
destructors as I would expect. It appears that 2nd Source needs to
return WORK_DONE as well to kill its subgraph, and thus the entire flow

Interesting – this might be a bug. Can you add it to the issue tracker?

outside of the destructor as originally intended.
You could attach a tag to the last item (“end of line” or something.
Suddenly thinking of “Tron”…).

When you see that, you know to send an EOL message to the second source
after sending it the last message.