discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Reconfiguring a hier_block2 without locking the t


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] Reconfiguring a hier_block2 without locking the top block
Date: Tue, 17 Mar 2009 12:01:30 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Mar 17, 2009 at 03:47:54PM +1300, Kieran Brownlees wrote:
> Hello all,
> 
> Is the code designed so you can .lock() a individual hier_block2 and
> reconfigure it without having to lock the overall top_block? IF you do have
> to lock the top block, why?
> 

You can lock/unlock on anything derived from from hier_block2 or top_block.


FWIW, your code works for me using the trunk as of r10628.
That is, it prints "Reconfiguring h_block", and then hangs.
(The hang is a different bug that will be addressed soon.)


> The code below causes a seg fault on my 3.1.3 and 3.2 installations.

If it printed anything before dying, can you please post that?
Can you generate a backtrace from the segfault using gdb?

Eric


> Sample code (http://pastebin.com/d413db7f7):
> 
> from gnuradio import gr
> 
> class h_block(gr.hier_block2):
>     def __init__(self):
>         gr.hier_block2.__init__(self, "hello", gr.io_signature(0, 0, 0),
> gr.io_signature(0, 0, 0))
>         self.source = gr.null_source(gr.sizeof_float)
>         self.sink = gr.null_sink(gr.sizeof_float)
>         self.connect(self.source, self.sink)
> 
>     def reconfigure(self):
>         self.lock()
>         self.disconnect(self.source, self.sink)
>         self.source = gr.null_source(gr.sizeof_float)
>         self.connect(self.source, self.sink)
>         self.unlock()
> 
> class top_block(gr.top_block):
>     def __init__(self):
>         gr.top_block.__init__(self)
>         self.h_block = h_block()
>         self.connect(self.h_block)
> 
> if __name__ == '__main__':
>     app = top_block()
>     app.start()
>     print "Reconfiguring h_block"
>     app.h_block.reconfigure()
>     app.stop()
> 
> Thank you,
> Kieran




reply via email to

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