Assisted-by: Claude Code:claude-opus-5-5
AI-Scope: Implemented the call for both widths from the thread block and checked it in the kernel threads test.
Zig's standard library waits through ntdll: it sleeps with
NtDelayExecution, parks threads with NtWaitForAlertByThreadId and wakes them
with NtAlertThreadByThreadId, interrupts waits with NtAlertThread, and waits
for its children with an alertable NtWaitForSingleObject. These now run on
the scheduler's waits:
- NtDelayExecution sleeps for a native timeout (100 ns units, negative from
now, positive a system time, none forever) and answers STATUS_USER_APC
when it ran APCs and STATUS_ALERTED when the thread was alerted.
- NtAlertThread alerts a thread's alertable native wait; NtTestAlert takes
the alert and runs the APCs.
- NtWaitForAlertByThreadId and NtAlertThreadByThreadId pair as their
documentation describes, an alert that comes first being kept.
- NtWaitForSingleObject and NtWaitForMultipleObjects wait as
WaitForSingleObjectEx and WaitForMultipleObjectsEx do, alertable ones
included, which the object layer refused; their results are the same
numbers.
Assisted-by: Claude Code:claude-opus-5-5
AI-Scope: the native wait, sleep and alert functions and the object test change
(cherry picked from commit 44686f355a19520c1c9abb10006adaecee34f114)
The .NET runtime looks it up and tests whether special user-mode APCs work.
With no flags it queues the APC QueueUserAPC queues. Special user-mode APCs,
which interrupt a thread outside an alertable wait, are not delivered here, so
those flags are refused; the runtime then suspends threads the other way, as
on systems without them.
Assisted-by: Claude Code:claude-opus-5-5
AI-Scope: the handler
(cherry picked from commit 3ec65bd94a8818d38ba568cd3258e2a9f466658d)
Go preempts a goroutine that runs too long by suspending its thread, reading
its context and setting it to call the runtime's preemption function. With
the clock now running, restic got that far and stopped on SetThreadContext.
The control and integer groups of the CONTEXT become the registers the
thread continues with: in its own task when it is paused there, in its saved
snapshot otherwise. A thread that is not suspended keeps its registers.
Assisted-by: Claude Code:claude-opus-5-5
AI-Scope: the handler and NativeProcess::set_thread_registers
(cherry picked from commit b1c31f9ffbea6bb1d91458193357184f305818f4)