Hi GNU hackers,

what is the accepted best practice to have a source and a sink block
share a common resource?
In my case, the shared resource is a thread that does I/O and both
source/sink use it to interface to GNU Radio.

First I thought about adding the I/O thread to the source block and use
the name of the source as parameter for the sink. However, as I have
seen from the GRC Python code generator implementation this may not
always work because instantiation/initialisation of blocks does not
happen in a particular order (e.g. sources before sinks).

Variables and parameters, on the other hand, are initialised first.
Therefore another approach could be to have the I/O thread in a separate
class, exported from my gr-module and accessible through Python, and
separately instantiated as and assigned to a variable that is passed to
parameters of my source/sink blocks.

Is there a commonly accepted pattern to apply in this situation?

Cheers,
-- nicolas

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

Reply via email to