[Top][All Lists]

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

Re: [Discuss-gnuradio] KeyboardInterrupt not being caught in top_block

From: Eric Blossom
Subject: Re: [Discuss-gnuradio] KeyboardInterrupt not being caught in top_block
Date: Wed, 16 Jun 2010 12:45:07 -0700
User-agent: Mutt/1.5.20 (2009-08-17)

What version of GNU Radio?
What OS, distribution, version?
(We fixed bugs in this area about a year ago...)

On Thu, Jun 17, 2010 at 12:29:10AM +1000, Kyle Zhou wrote:
> Basically, I want to catch Ctrl+C after top_block.run()
> For example
>     try:
>         my_top_block().run()
>     except KeyboardInterrupt:
>         print "Ctrl+C has been pressed. Exiting."
> However, when Ctrl+C is pressed, the program exits straight away without
> executing the print function.
> It seems that KeyboardInterrupt is not propagated to the main thread?
> What am I doing wrong?
> By the way, if I caught some exception in work(), what is the best way to
> exit the program? top_block.stop() or raise SystemExit, 1?

Just return -1 from work.  The graph will stop.


reply via email to

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