[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Should return the number of input or the number o
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] Should return the number of input or the number of output? |
Date: |
Mon, 10 Mar 2014 10:42:27 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/09/2014 04:58 AM, Activecat wrote:
> Dear Sir,
>
> A python sink block created by gr_modtool has below work() function, it
> returns the number of input items.
>
> def work(self, input_items, output_items):
> in0 = input_items[0]
> # <+signal processing here+>
> return len(input_items[0])
>
> But a c++ sink block created by gr_modtool has the work() function
> return the number of output items (noutput_items).
>
> It sounds contradict. Is there any error happening?
No contradiction. Sinks are always syncs (haha), so noutput_items == the
number of input items (by definition). The actual output buffer,
however, is empty -- so we can't use the length of the output buffer to
tell the scheduler how much we consumed.
In a sync block, there is no argument "ninput_items", so we can't use
that, either.
M