![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
Detects blocked or overloaded worker event loops. More...
#include <event_loop_watchdog.h>
Public Member Functions | |
| EventLoopWatchdog (Servatrice *_servatrice, QString _threadName) | |
| void | start () |
Static Public Attributes | |
| static constexpr int | HeartbeatIntervalMs = 500 |
| How often the heartbeat expects to fire. Small enough to catch short stalls. | |
Private Slots | |
| void | checkHeartbeat () |
Private Attributes | |
| Servatrice * | servatrice |
| QString | threadName |
| QElapsedTimer | sinceLastTick |
| QTimer * | heartbeatTimer = nullptr |
Detects blocked or overloaded worker event loops.
One instance lives in each socket pool thread. A heartbeat timer tick that arrives late means the loop spent that time elsewhere: busy work, a queued slot, or a hard wedge. Overshoots past the configured threshold bump lock-free counters on the metrics registry and log one warning per stall, so a stuck pool thread becomes visible instead of silent lag.
| EventLoopWatchdog::EventLoopWatchdog | ( | Servatrice * | _servatrice, |
| QString | _threadName ) |
|
privateslot |
| void EventLoopWatchdog::start | ( | ) |
Starts the heartbeat timer. Must be invoked queued after the instance was moved to its target thread so the timer lives there too.
|
staticconstexpr |
How often the heartbeat expects to fire. Small enough to catch short stalls.
|
private |
|
private |
|
private |
|
private |