Files
BearddOddity 95079c1617 kernel: RECOMP_WAIT_LOG, an opt-in log of long or timed-out waits
Debug aid, off by default. With RECOMP_WAIT_LOG=1 each
NtWaitForSingleObject, NtWaitForSingleObjectEx and KeWaitForSingleObject
that timed out or lasted at least 500 ms writes one [WAIT] line to stderr:
thread, handle, timeout, result, time waited. It shows which handle a
stalled thread keeps waiting on. Waits behave as before in every case.

Test: tests/kernel_wait_log redirects stderr to a file and makes the three
waits time out on an unsignalled event, then does a signalled wait. Run
with the variable set it expects exactly three [WAIT] lines (one per
function, each with the 20 ms timeout and the timeout result) and none for
the signalled wait; run with it unset it expects none.

Verified: both runs pass on Windows (MSVC) and Linux x86-64 (gcc). With
kernel_sync.c at v0.16.0 the "set" run fails and the "unset" run passes.

Blast radius: kernel_sync.c only. Unset, the switch adds no output and no
behaviour change; the only other difference is three standard includes. Not
covered: the multi-object waits.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 04:31:26 -05:00
..