|Subject:||Re: [Discuss-gnuradio] Threaded GRC blocks|
|Date:||Fri, 16 Jan 2015 18:24:28 +0100|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0|
I'll try to structure this and reply in-text, so we can get to a mutual understanding faster :)
> My application buffers a bunch of data and then performs some signal processing on it that can take up to 500ms.
Does that mean it takes up to 0.5s worth of sampled signal, or does just the computation take that long? Is there something like a minimum block size of samples that your algorithm needs?
Here, a bit of info on what you're actually doing would be nice.
> Once processing is complete, the processing thread waits a certain amount of time before reading the buffer and then processing again, meanwhile the main trhread is consuming samples and advancing a sample counter.
GNU Radio will do exactly that for you: you just write a block that transforms a set of input items to a set of output items, and GNU Radio cares about how to fill your input buffer, when to call you, how to inform you how much items there are to process, and how to notify your downstream flowgraph neighbors about new data.
> I was wondering what the best way to implement this as a GRC block.
Depends on what you do in that block. I have my doubts about your 500ms computation step not being split into smaller processing steps; but the feasibility of that completely depends on the actual thing you want to do...
> Currently I am creating the thread in the the block constructor and killing it in the destructor.
That sounds a bit like you're doing GNU Radio wrong. Your block is already running in a thread of its own -- that's what the thread-per-block scheduler does for you ;)
On 01/16/2015 06:13 PM, Jon West wrote:
|[Prev in Thread]||Current Thread||[Next in Thread]|