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

2014-02-22 Thread Martin Braun
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

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


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

2014-02-21 Thread Tommy Tracy II
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 martin.br...@ettus.com 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
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


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

2014-02-10 Thread Tommy Tracy II
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?

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



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio