Problem with top_block.stop()

I am trying to pass two different parameters to my top_block class
I m not able to do this please help. The control of program gets stuck
at
tb.stop() and doesn’t go beyond that.

tb=top_block(options,0.8)
tb.start()
tb.wait()
tb.stop()
sleep(5)
print “I AM BACK”
tb1=top_block(options,0.4)
tb1.start()
tb1.wait()
tb1.stop()
sleep()

Regards,
Sumedha

On Tue, Dec 17, 2013 at 12:23 PM, Sumedha G. [email protected]
wrote:

tb1=top_block(options,0.4)
tb1.start()
tb1.wait()
tb1.stop()
sleep()

Regards,
Sumedha

Does your flowgraph in tb naturally stop? The tb.wait() is a blocking
call and will halt the main loop there until all threads (blocks) in
tb are done. If your flowgraph doesn’t have something that stops
execution (like a finite file or a blocks.head block), then it will
continue to process forever and your tb.wait() will continue to block.

Tom

On Dec 17, 2013, at 9:23, Sumedha G. [email protected] wrote:

I am trying to pass two different parameters to my top_block class
I m not able to do this please help. The control of program gets stuck at
tb.stop() and doesn’t go beyond that.

tb=top_block(options,0.8)
tb.start()
tb.wait()
tb.stop()
sleep(5)

If you want to stop a running flow graph you must not wait() for it
first. wait() waits until either it is stopped or it completes
naturally. Thus, you want this order of operations:

tb=top_block(options,0.8)
tb.start()
sleep(5)
tb.stop()
tb.wait()

The wait() occurs last so that what it is waiting for is only for the
stop() to complete, not for anything else.


Kevin R. http://switchb.org/kpreid/

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