discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How to know that the last sample has arrived


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] How to know that the last sample has arrived
Date: Fri, 31 Mar 2017 13:47:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

Hi Ruben,

If I consume (ninput_items[0] - 1) samples every time general_work is
called, I will eventually get general_work called with ninput_items[0]
== 1. Would this be a reliable way to do it? Or is there a more
straightforward way which I cannot see?
Oh, I *think* that might work, but really you shouldn't rely on the scheduler never calling you with a single sample – we nowhere say it wouldn't do that during normal operation.

The goal is to have a block which reliably appends something specific
after the last incoming sample. When I detect that the last sample has
arrived, the following call to forecast will return 0, causing
general_work to be called again even when ninput_items[0] == 0, and I
then return -1 when all the appended samples have been produced. That
seems to work fine, but I am unsure if there is a more straight
forward way.
I honestly think that way is at least more reliable than the one you sketched above, but probably still not all that reliable.

I think we'll need input from the others on this, but I think we do not have a "guaranteed" way of making this work without adding hooks to the scheduler that we do not have yet.

I'd rather find a way to access the block executor of the next block upstream and ask it whether it is done.

Best regards,
Marcus

On 31.03.2017 12:06, Ruben Undheim wrote:
Hi,

Is there a good way to find out from inside general_work that the last
sample has arrived? (such as from vector_source_X or file_source)

If I consume (ninput_items[0] - 1) samples every time general_work is
called, I will eventually get general_work called with ninput_items[0]
== 1. Would this be a reliable way to do it? Or is there a more
straightforward way which I cannot see?

The goal is to have a block which reliably appends something specific
after the last incoming sample. When I detect that the last sample has
arrived, the following call to forecast will return 0, causing
general_work to be called again even when ninput_items[0] == 0, and I
then return -1 when all the appended samples have been produced. That
seems to work fine, but I am unsure if there is a more straight
forward way.

Best regards

Ruben

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


reply via email to

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