How to stop top block?

Hello,
I am trying to change some options dynamically. Right now I am trying
this
with benchmark_ofdm_rx.py, I add one new class for dynamically enter the
new
option value and change it in the program. However I found those
options,
except center frequency and gain, all cannot be effectively changed just
by “disconnec+rebuild a receive_path+connect”. I did successfully change
the
options and make it work through that way, but that’s only before I
start the
my_top_block, once the top block started, nothing can be effectively
changed
(again except center frequency).

On way I thought about is to stop the top block before changeing the
value,
but that’s also no way to do that, because the top block won’t stop
indeed
even I use tb.stop().(This can be proved that the top block cannot be
restarted by tb.start(), errors will come up saying top block is
running).

Is there any effective way to change options dynamically or stop/start
the top
block?

Thanks a lot.

On Fri, Aug 21, 2009 at 12:03:51AM +0000, Yan Wang wrote:

On way I thought about is to stop the top block before changeing the value,
but that’s also no way to do that, because the top block won’t stop indeed
even I use tb.stop().(This can be proved that the top block cannot be
restarted by tb.start(), errors will come up saying top block is running).

Is there any effective way to change options dynamically or stop/start the top
block?

Thanks a lot.

No need to stop the graph to alter the connections.

Use lock/unlock. E.g.,

top_block.lock()
disconnect(…)

connect(…)

top_block.unlock()

There are some exxamples that do this, and there’s been discussion on
the mailing list.

Eric

On Thu, Aug 20, 2009 at 10:02:35PM -0400, Yan Wang wrote:

Hi Eric,
Thanks for you quick answer.
I think I’ve tried lock and unlock, they are also not working.

Have you looked at the examples that use lock and unlock?

Am I doing this in the right way? Right now I’ve tried all these in a
different thread from the main thread, which has the top_block running.

The main thread is fine. It can’t be one of the threads running a
block, which implies that you can’t call lock/unlock from within a
block’s work function.

Must I do this in the same thread? I introduced top_block into the new
thread, and use self._top_block = top_block, then use
self._top_block.lock(), is that OK?

Thanks for your help.

Best regards,
Yan Wang

Please use the “Reply-All” button on your mailer so that your replies
get copied to the discuss-gnuradio mailing list. Otherwise it only
goes the sender, and then won’t be available in the list archives for
others.

Eric

Thanks a lot, I got it.

Eric B. <eb comsec.com> writes:

top_block.lock()
disconnect(…)

connect(…)

top_block.unlock()

Thank you Eric,
I found the lock/unlock function can work only in benchmark_ofdm_rx.py.
When I use them to change the graph or even not change any thing with
benchmark_ofdm_tx.py, the transmitting just stopped. No packets can be
received although the transmitter is still printing out “.”
I cannot find out what’s wrong with it, do you?
Thanks a lot.

Best regards,
Yan Wang

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs