[Qt-interest] how to trace the Unix signal?
zhu minjue
zu.real.miracle at gmail.com
Mon Jan 11 04:37:40 CET 2010
I want to do some specified operations in my Qt application when system
reboot.I notice that connect the 'unixSignal' in Qt can do this work.But
actually I have not seen any response.My code likes this:
class BsApp: public QApplication
{
Q_OBJECT
public:
BsApp(int &argc, char **argv): QApplication (argc,argv)
{
watchUnixSignal(SIGINT,true);
watchUnixSignal(SIGTERM,true);
watchUnixSignal(SIGHUP,true);
connect(this,SIGNAL(unixSignal(int)),this,SLOT(sighandler(int)));
}
virtual ~BsApp(){}
public slots:
void sighandler(int nr)
{
/*output the nr value to local file in order to trace */
...
switch(nr)
{
case SIGINT:
case SIGTERM:
exit(0);
break;
case SIGHUP:
break;
}
}
};
I run my UI application,reboot the system.after the system turn on,there
is no any output.But if I explicitly send the 'TERM' signal in Shell
terminal:
$ kill -15 5323
The Qt UI application do receive the 'SIGTERM' signal and output the
result.
Does anyone know why this happen?any suggestion?
More information about the Qt-interest-old
mailing list