From tobias at ...692... Tue Feb 4 18:04:01 2014 From: tobias at ...692... (Tobias Boege) Date: Tue, 4 Feb 2014 18:04:01 +0100 Subject: [Gambas-devel] GB.Signal.Register() keeps program running? Message-ID: <20140204170401.GE515@...693...> 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 -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk From gambas at ...1... Tue Feb 4 23:44:08 2014 From: gambas at ...1... (=?ISO-8859-1?Q?Beno=EEt_Minisini?=) Date: Tue, 04 Feb 2014 23:44:08 +0100 Subject: [Gambas-devel] GB.Signal.Register() keeps program running? In-Reply-To: <20140204170401.GE515@...693...> References: <20140204170401.GE515@...693...> Message-ID: <52F16D38.70204@...1...> 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. -- Beno?t Minisini From tobias at ...692... Wed Feb 5 12:58:00 2014 From: tobias at ...692... (Tobias Boege) Date: Wed, 5 Feb 2014 12:58:00 +0100 Subject: [Gambas-devel] GB.Signal.Register() keeps program running? In-Reply-To: <52F16D38.70204@...1...> References: <20140204170401.GE515@...693...> <52F16D38.70204@...1...> Message-ID: <20140205115800.GA8944@...693...> 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... Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk