summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/QtUtils/SignalDaemon.h
blob: d3ba67cbc1ef249cfa8d3f1745e212a140324555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2018 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <QObject>

class QSocketNotifier;

// Loosely based on https://doc.qt.io/qt-5.9/unix-signals.html
class SignalDaemon : public QObject
{
  Q_OBJECT

public:
  explicit SignalDaemon(QObject* parent);
  ~SignalDaemon();

  static void HandleInterrupt(int);

signals:
  void InterruptReceived();

private:
  void OnNotifierActivated();

  static int s_sigterm_fd[2];

  QSocketNotifier* m_term;
};