Skip to content

Commit

Permalink
Help debug watchdog timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks committed Nov 28, 2023
1 parent 160978e commit c8e99c5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tools/spin/spinquic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,19 @@ class SpinQuicWatchdog {
CXPLAT_THREAD WatchdogThread;
CXPLAT_EVENT ShutdownEvent;
uint32_t TimeoutMs;
CXPLAT_THREAD_ID OriginThread;
static
CXPLAT_THREAD_CALLBACK(WatchdogThreadCallback, Context) {
auto This = (SpinQuicWatchdog*)Context;
if (!CxPlatEventWaitWithTimeout(This->ShutdownEvent, This->TimeoutMs)) {
printf("Watchdog timeout fired!\n");
printf("Watchdog timeout fired while waiting on thread 0x%x!\n", (int)This->OriginThread);
CXPLAT_FRE_ASSERTMSG(FALSE, "Watchdog timeout fired!");
}
CXPLAT_THREAD_RETURN(0);
}
public:
SpinQuicWatchdog(uint32_t WatchdogTimeoutMs) : TimeoutMs(WatchdogTimeoutMs) {
SpinQuicWatchdog(uint32_t WatchdogTimeoutMs) :
TimeoutMs(WatchdogTimeoutMs), OriginThread(CxPlatCurThreadID()) {
CxPlatEventInitialize(&ShutdownEvent, TRUE, FALSE);
CXPLAT_THREAD_CONFIG Config = { 0 };
Config.Name = "spin_watchdog";
Expand Down

0 comments on commit c8e99c5

Please sign in to comment.