Files
psxrecomp/runtime
Kevin 430c93b8a4 runtime: fix starvation watchdog cross-thread wrap; label watchdog and console exits
starvation_watchdog_check() sampled the clock before loading the heartbeat,
but the heartbeat is also stamped by the debug-server IO thread on every
send() chunk. A stamp landing between the two reads made last > now, the
uint64 subtraction wrapped past any threshold, and a healthy runtime exited
with code 2 (BoF3 2026-09-02: 402 us of real staleness tripped the 4 s
watchdog within ~2 min whenever the area poller was attached).

- Load the heartbeat first, decide through the new pure helper
  starvation_watchdog_stale(), which refuses a negative gap by construction
  (same shape as the frame_pacing_sleep_ms fix).
- Make s_last_heartbeat_us _Atomic with relaxed store/load.
- Tag the exit origin: "starvation_watchdog" on the trip, console_close /
  console_ctrl_break / console_ctrl_c in the Win32 console handler, and
  signal_sigint / signal_sigterm in the soft-exit handler. These all used
  to reach psx_atexit_handler as atexit/unknown, indistinguishable from an
  SDL window close.
- Add starvation_watchdog_test (ctest) pinning the decision function.

Verified on BoF3 build-dbg: 10 min soak with the poller polling at 1 s and
the watchdog enabled at its 4 s default, no dump, process alive; forced
trip with PSX_STARVATION_TIMEOUT_US=1000 fires and the run report reads
exit_origin "starvation_watchdog".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 12:17:16 -04:00
..
2026-08-15 14:46:26 -07:00
2026-08-13 10:37:18 -04:00
2026-07-29 03:18:10 -04:00