Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
event_loop_watchdog.h
Go to the documentation of this file.
1
5
6#ifndef EVENT_LOOP_WATCHDOG_H
7#define EVENT_LOOP_WATCHDOG_H
8
9#include <QElapsedTimer>
10#include <QObject>
11#include <QString>
12#include <qtmetamacros.h>
13
14class Servatrice;
15class QTimer;
16
26class EventLoopWatchdog : public QObject
27{
28 Q_OBJECT
29public:
31 static constexpr int HeartbeatIntervalMs = 500;
32
33 EventLoopWatchdog(Servatrice *_servatrice, QString _threadName);
34
39 void start();
40
41private slots:
42 void checkHeartbeat();
43
44private:
46 QString threadName;
47 QElapsedTimer sinceLastTick;
48 QTimer *heartbeatTimer = nullptr;
49};
50
51#endif
QElapsedTimer sinceLastTick
Definition event_loop_watchdog.h:47
void checkHeartbeat()
Definition event_loop_watchdog.cpp:27
static constexpr int HeartbeatIntervalMs
How often the heartbeat expects to fire. Small enough to catch short stalls.
Definition event_loop_watchdog.h:31
QTimer * heartbeatTimer
Definition event_loop_watchdog.h:48
EventLoopWatchdog(Servatrice *_servatrice, QString _threadName)
Definition event_loop_watchdog.cpp:14
void start()
Definition event_loop_watchdog.cpp:19
QString threadName
Definition event_loop_watchdog.h:46
Servatrice * servatrice
Definition event_loop_watchdog.h:45
Definition servatrice.h:149