discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Problem with gr_head in simple graph


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] Problem with gr_head in simple graph
Date: Wed, 7 Mar 2007 07:00:06 -0800
User-agent: Mutt/1.5.9i

On Wed, Mar 07, 2007 at 11:29:19AM +0100, Dominik Auras wrote:
> Hi!
> 
> I am encountering a problem with gr_head. For my testcase, I set up a
> flow graph:
> 
> (...)
> tcp_src = qtblocks.tcp_source (gr.sizeof_char, "127.0.0.1", 7777)
> head = gr.head(gr.sizeof_char, 4)
> vector_sink = gr.vector_sink_b()
> self.fg.connect (tcp_src, head, vector_sink)
> (...)
> 
> The logging in the single threaded scheduler is active. It outputs the
> following:
> 
> --- snip ---
> <gr_block tcp_source (5)> source
>   noutput_items = 32767
>   general_work: noutput_items = 32767 result = 0

This is the first odd thing, and I believe the cause of the problem.
Your source does not block until it receives something.
Generally speaking, returning 0 is a bad idea.

In the case of sources, you should block until you get something, then
return whatever you got.

What happens when any block declares that it is done, is that
everything is allowed to run until no further progress can be made.
In your case, the upstream block, the tcp_source, will run until it's
finally "output blocked" because of "back pressure" that results
because gr.head is done.  Given that your source produces 0 output,
it'll never see any back pressure and thus will never end.

Philosophically, we don't stop everything as soon as any block says
it's done, because other blocks may have side effects that we are
still interested in (e.g., logging results), or are still able to make
progress.

Outside of your test case, what are you really trying to do?

Eric

> 
> The problem is that the graph does not stop. The source still outputs
> items though its destination signaled done.
> 
> Greetings,
> Dominik




reply via email to

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