Skip to content

Commit

Permalink
helper class to send a signal to a process
Browse files Browse the repository at this point in the history
  • Loading branch information
wdehoog committed Jan 4, 2019
1 parent d5db3bb commit d29cafb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/systemutil.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "systemutil.h"
#include <signal.h>

SystemUtil::SystemUtil(QObject *parent) {

}

void SystemUtil::pkill(uint pid, int signal) {
kill(pid, signal);
}
33 changes: 33 additions & 0 deletions src/systemutil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef SYSTEMUTIL_H
#define SYSTEMUTIL_H

#include <QObject>

class SystemUtilEnums : public QObject
{
Q_OBJECT

Q_ENUMS(Signals)

public:
enum Signals {
SIGHUP = 1,
SIGINT = 2,
SIGQUIT = 3,
SIGUSR1 = 10,
SIGUSR2 = 12,
SIGTERM = 15
};
};

class SystemUtil : public QObject
{
Q_OBJECT
public:
explicit SystemUtil(QObject *parent = 0);

public slots:
Q_INVOKABLE void pkill(uint pid, int signal);
};

#endif // SYSTEMUTIL_H

0 comments on commit d29cafb

Please sign in to comment.