[Gambas-devel] GB.Signal.Register() keeps program running?
tobias at ...692...
Wed Feb 5 12:58:00 CET 2014
On Tue, 04 Feb 2014, Beno?t Minisini wrote:
> Le 04/02/2014 18:04, Tobias Boege a ?crit :
> > Hi Benoit,
> > I wondered why all gb.ncurses programs (even if they don't watch any input
> > fds) won't quit after they finished Main(). The reason is that gb.ncurses
> > registers a signal handler via GB.Signal.Register() (because removing that
> > line from the sources makes those programs terminate after Main()).
> > Is this intentional? Can't we register a signal handler and anyway quit
> > normally after Main() if the signal didn't came?
> > Regards,
> > Tobi
> Yes, you must use GB.Signal.Unregister() to remove the signal handler.
Hmm, but when? How about this: I always register the signal handler and use
GB_HOOK_WATCH to detect when nothing is watched anymore. Then, I can remove
the signal handler and the program will terminate.
The only case where this doesn't work, is when nothing is watched at all
during the process' lifetime...
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the Devel