Hi
I am having problems catching unix signals in a multithreaded application. The signals are caught fine unless I start a thread at which point the default signal handling occurs.
To create signal handlers I am using the following code which is located in main:
signal(SIGINT, shutdown);
signal(SIGINT, shutdown);
To copy to clipboard, switch view to plain text mode
This should cause the shutdown function to run on a SIGINT, however when I start a thread the above no longer works as expected. The following code is being used to start the thread:
XmlRpcServer* xmlServer = new XmlRpcServer;
xmlServer->moveToThread(&xmlServerThread);
xmlServer->connect(&xmlServerThread,
SIGNAL(started()),
SLOT(startServer()));
xmlServerThread.start();
XmlRpcServer* xmlServer = new XmlRpcServer;
QThread xmlServerThread;
xmlServer->moveToThread(&xmlServerThread);
xmlServer->connect(&xmlServerThread,
SIGNAL(started()),
SLOT(startServer()));
xmlServerThread.start();
To copy to clipboard, switch view to plain text mode
I'd be grateful for any advice anyone can offer as this has been stumping me for a while.
Bookmarks