Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
EventLoopWatchdog Class Reference

Detects blocked or overloaded worker event loops. More...

#include <event_loop_watchdog.h>

Inheritance diagram for EventLoopWatchdog:
[legend]
Collaboration diagram for EventLoopWatchdog:
[legend]

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ EventLoopWatchdog()

EventLoopWatchdog::EventLoopWatchdog ( Servatrice * _servatrice,
QString _threadName )
Here is the caller graph for this function:

Member Function Documentation

◆ checkHeartbeat

void EventLoopWatchdog::checkHeartbeat ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ HeartbeatIntervalMs

int EventLoopWatchdog::HeartbeatIntervalMs = 500
staticconstexpr

How often the heartbeat expects to fire. Small enough to catch short stalls.

◆ heartbeatTimer

QTimer* EventLoopWatchdog::heartbeatTimer = nullptr
private

◆ servatrice

Servatrice* EventLoopWatchdog::servatrice
private

◆ sinceLastTick

QElapsedTimer EventLoopWatchdog::sinceLastTick
private

◆ threadName

QString EventLoopWatchdog::threadName
private

The documentation for this class was generated from the following files: