20 #include <QCoreApplication> 31 fprintf(stderr,
"quit the application by signal(%d).\n", sig);
32 QCoreApplication::quit();
37 sigset_t blocking_mask;
38 sigemptyset(&blocking_mask);
40 for (std::vector<int>::const_iterator it = quitSignals.begin(); it != quitSignals.end(); ++it) {
41 sigaddset(&blocking_mask, *it);
46 sa.sa_mask = blocking_mask;
49 for (std::vector<int>::const_iterator it = quitSignals.begin(); it != quitSignals.end(); ++it) {
50 sigaction(*it, &sa, 0);
57 QCoreApplication a(argc, argv);
59 QCoreApplication::setOrganizationName(
"f4exb");
60 QCoreApplication::setApplicationName(
"SDRangelSrv");
61 QCoreApplication::setApplicationVersion(SDRANGEL_VERSION);
64 int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
65 std::vector<int> vsig(catchSignals, catchSignals +
sizeof(catchSignals) /
sizeof(
int));
72 #if QT_VERSION >= 0x050400 73 qInfo(
"%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld",
74 qPrintable(QCoreApplication::applicationName()),
75 qPrintable(QCoreApplication::applicationVersion()),
76 qPrintable(QString(QT_VERSION_STR)),
78 qPrintable(QSysInfo::currentCpuArchitecture()),
79 qPrintable(QSysInfo::prettyProductName()),
82 QCoreApplication::applicationPid());
84 qInfo(
"%s %s Qt %s %db DSP Rx:%db Tx:%db PID %lld",
85 qPrintable(QCoreApplication::applicationName()),
86 qPrintable((QCoreApplication::>applicationVersion()),
87 qPrintable(QString(QT_VERSION_STR)),
91 QCoreApplication::applicationPid());
97 QObject::connect(&m, SIGNAL(finished()), &a, SLOT(quit()));
102 int main(
int argc,
char* argv[])
106 int res = runQtApplication(argc, argv, logger);
107 qWarning(
"SDRangel quit.");
void catchUnixSignals(const std::vector< int > &quitSignals)
void parse(const QCoreApplication &app)
int main(int argc, char *argv[])