discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Reconfiguring a hier_block2 without locking the top b


From: Kieran Brownlees
Subject: [Discuss-gnuradio] Reconfiguring a hier_block2 without locking the top block
Date: Tue, 17 Mar 2009 15:47:54 +1300

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?

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

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]