Opened 21 months ago
Closed 21 months ago
SignalHandler does not handle SIGTERM and SIGINT when there is no event loop.
|Reported by:||danielk||Owned by:||beirdo|
|Component:||MythTV - General||Version:||Master Head|
There are really two problems:
1/ A program like mythcomflag/mythtranscode/mythccextractor won't be running an event loop so the QSocketNotifier will never fire a handleSignal(). This could be addressed by calling QCoreApplication::processEvents() periodically.
2/ If you aren't running in a qApp->exec() then qApp->quit()/qApp->exit(int) doesn't do anything. This could be addressed by setting a static volatile bool when the program should exit and having the program check that after calling QCoreApplication::processEvents().
It might also make sense to set the signal handler to the default within SignalHandler::signalHandler(), then a second SIGKILL or a second SIGINT would kill the program a less elegantly. This would allow routines where forget to add the above to to exit. But we probably wouldn't want to do this right away as we want to identify the places where there is no proper program exit on a signal and not exiting is one way to do that.