discuss-gnuradio
[Top][All Lists]
Advanced

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

Message Passing Python File Source Block, GNU Radio 3.9.3.0


From: Patric Müller
Subject: Message Passing Python File Source Block, GNU Radio 3.9.3.0
Date: Fri, 6 May 2022 15:37:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

Dear all,
I am currently trying to create a Flowgraph, which only runs once and then quits. When using Streams and Custom Python Blocks, I am able to create a Flowgraph that completes and exits completely. I select the Run Options in the Option Block to "Run to Completion" and use the function `gr.block.consume_each()` to notify the scheduler about the consumed Samples.

Now I want to do the same while only utilizing Message Passing. My minimal example consists of a self written File Source Block and a self written save to file Block. For the implementation of the File Source I used threading. This works, but the Flowgraph never completes, I suspect that the thread still continues to run in the background.

I have created another Flowgraph, which uses the standard File Source, then converts the stream to a message and finally saves it with my self written save to file block. This Flowgraph completes fine, so I do not think that the Save to File Block is the issue.

My question now is, how can I write a Python Block, which runs only once (similar to the standard File Source with Repeat=No) that reads a file and outputs it on a message port? How can I tell the scheduler, that all messages have been consumed?

Here is my current File Source which uses threading:
https://pastebin.com/6pNVgfPS


Thanks for looking into this and kind regards,
Patric Müller




reply via email to

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