discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Does a block always *have* to return something?


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Does a block always *have* to return something?
Date: Mon, 22 Jun 2015 09:01:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Hi Anil,

> Does a block always *have* to return something?
What you mean is the work function. I know this is a bit nit-picky, but
there has always been a lot of confusion caused by exactly that: The
block is the whole instance of a class derived from gr.block, and the
work() (or general_work()) is the method of that class which gets called
repeatedly at runtime. You can have state as properties of the instance.

I'm not quite sure what the effect of returning None (which is what
happens when you don't return something in python) is, because that
NoneObject would then be handled through SWIF to C++, and I have no idea
whether SWIG has a uniform way of converting NoneObjects to integers.

In essence: yes, general_work() must always return a number, but in most
cases it's totally O.K. to return 0 if your block wasn't able to produce
output.

Best regards,
Marcus



reply via email to

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