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: Tommy Tracy II
Subject: Re: [Discuss-gnuradio] How does a C++ custom block kill the FlowGraph
Date: Fri, 21 Feb 2014 12:27:39 -0500

Thank you. 

I have another question. 

I have a strange situation where I have two sub-flowgraphs. The two sub-flowgraphs are connected by a message queue. The 1st Sink can talk to the 2nd Source through this queue.

TOP BLOCK{
     1st subgraph [1st Source]——[…]——[1st Sink]
     2nd subgraph [2nd Source] ——[…]——[2nd Sink]
}

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.

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.

Sincerely,
Tommy James Tracy II
Ph.D Student
High Performance Low Power Lab
University of Virginia
Phone: 913-775-2241

On Feb 10, 2014, at 12:33 PM, Martin Braun <address@hidden> wrote:

On 10.02.2014 09:18, Tommy Tracy 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 it’s 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.

MB

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

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