discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How does a C++ custom block kill the FlowGraph


From: Martin Braun
Subject: Re: [Discuss-gnuradio] How does a C++ custom block kill the FlowGraph
Date: Sat, 22 Feb 2014 14:17:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 02/21/2014 06:27 PM, Tommy Tracy II wrote:
> Both sub-flowgraphs use the same top block (you can’t have two top
> blocks in one application). Unfortunately, because they are disjoint, if
> the 1st Source returns WORK_DONE, it won’t call the other blocks’
> destructors as I would expect. It appears that 2nd Source needs to
> return WORK_DONE as well to kill it’s subgraph, and thus the entire flow
> graph.

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

> My problem is that 2nd Source depends on 1st Sink. My original plan was
> for 1st Sink to send a message ‘stop’ to 2nd Source, which would then
> return WORK_DONE and effectively kill the entire flow graph.
> Unfortunately, my plan was to do this in the destructor of 1st Sink,
> because at that point the 1st’s sink know’s it’s done processing. This
> destructor isn’t called until all blocks are done, so I’ve got a cyclic
> dependency.
> 
> Is it possible for blocks to know if other blocks are done? I could have
> some code in my 1st Sink's work function send that ‘stop’ message
> 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.

M



reply via email to

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