PosixSignalWatcher

This commit is contained in:
2020-06-27 10:04:56 +03:00
parent 44cd25464f
commit ca83f98484
7 changed files with 378 additions and 6 deletions

View File

@@ -0,0 +1,21 @@
#include <myx/qt/posix_signal_watcher.hpp>
#include <QCoreApplication>
#include <QDebug>
namespace MQ = myx::qt;
int main( int argc, char* argv[] )
{
QCoreApplication app( argc, argv );
qDebug() << "Hello from process" << QCoreApplication::applicationPid();
MQ::PosixSignalWatcher sigwatch;
sigwatch.watchForSignal( SIGINT );
sigwatch.watchForSignal( SIGTERM );
QObject::connect( &sigwatch, &MQ::PosixSignalWatcher::posixSignal, &app, &QCoreApplication::quit );
int exitcode = app.exec();
qDebug() << "Goodbye";
return( exitcode );
}