Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-processwaiter.h
1#ifndef QX_PROCCESSWAITER_H
2#define QX_PROCCESSWAITER_H
3
4// Qt Includes
5#include <QObject>
6#include <QBasicTimer>
7
8namespace Qx
9{
12class AbstractProcessWaiter : public QObject
13{
14 Q_OBJECT
15//-Class Members------------------------------------------------------------------------------------------
16protected:
17 static const int CLEAN_KILL_GRACE_MS = 5000;
18
19//-Instance Members------------------------------------------------------------------------------------------
20protected:
21 // Data
22 quint32 mId;
23
24 // Functional
25 QBasicTimer mDeadWaitTimer;
26 std::function<void(bool)> mDeadWaitCallback;
27
28//-Constructor----------------------------------------------------------------------------------------------
29public:
30 explicit AbstractProcessWaiter(QObject* parent);
31
32//-Instance Functions----------------------------------------------------------------------------------------------
33private:
34 void postDeadWait(bool died);
35 void timerEvent(QTimerEvent* event) override;
36
37protected:
38 void waitForDead(std::chrono::milliseconds timeout, std::function<void(bool)> callback);
39 virtual void closeImpl(std::chrono::milliseconds timeout, bool force) = 0;
40
41public:
42 virtual bool wait() = 0;
43 virtual bool isWaiting() const = 0;
44 void close(std::chrono::milliseconds timeout, bool force);
45 void setId(quint32 id);
46
47//-Slots------------------------------------------------------------------------------------------------------------
48protected slots:
49 virtual void handleProcessSignaled() = 0;
50
51//-Signals------------------------------------------------------------------------------------------------------------
52signals:
53 void dead();
54 void closeFailed();
55};
56
58}
59
60#endif // QX_PROCCESSWAITER_H
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5