[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] how to limit the size of buffer/queue for a block
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] how to limit the size of buffer/queue for a block? |
Date: |
Tue, 11 Mar 2014 15:12:13 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/11/2014 02:20 PM, Sumedha Goyal wrote:
> Hello
>
> The flowgraph of my top_block has test_demo as one of the blocks. The
> work() function associated with it has only one print statement.
> When I execute the flowgraph, the statement keeps on printing the
> statement " I AM IN WORK" on the screen. Why does it happen?
> My flowgraph is :
> File source--->stream to datagram--->test_demo---->datagram to
> stream----->file sink
>
> test_demo.py is :
Sumedha,
when posting Python code, make sure the indents get preserved (ideally,
don't send HTML emails).
M
>
> import timing
> import numpy
> import gras
> import Queue
> import thread
> from gnuradio import gr
> from gnuradio import digital
> from gnuradio import uhd
> import grextras
>
>
> class test_demo(gras.Block):
>
> def __init__(self, threshold):
> gras.Block.__init__(self,name="test_demo",
> in_sig = [numpy.uint8,numpy.uint8,numpy.uint8],
> out_sig = [numpy.uint8,numpy.uint8])
> self.input_config(0).reserve_items = 0
> self.input_config(1).reserve_items = 0
> self.output_config(1).reserve_items = 4096
> self.output_config(0).reserve_items = 4096
> self.threshold=threshold
> print "inside test_demo"
>
> def work(self,ins,outs):
> print "I AM IN WORK"
>
> If it is due to the size of buffer/queue of the block then how can I
> limit it?
> I understand that work() keeps on executing till the block receives
> something at its input ports. I want work() to return the control to
> main flowgraph upon satisfying a user specified condition such as
> if (i=5):
> self.mark_done()
> It should ignore all the pending packets of the buffer/queue.
> I want to start my flowgraph fresh after this process.
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>