mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 13:39:58 -04:00
End a hung fatal error's report with its own code when a thread waiting beside it gives up, not with the crash code.
The review of the shared failure guard found that a thread parked in dispatch.c rt_ending_enter ended the process with 71 after 30 s even when the first report was a FATAL (70, or 72 for a lost device), so a fatal error whose report hung read as a crash to the launcher. rt_ending_enter now takes the code its caller ends with: fatal_end passes its own, main.c crash_handler 71. The first caller stores it next to ending_tid, and a waiting thread that gives up after 30 s ends the process with it. Before the store the value is 71, as before. Reproduced before the change with a one-off build of tests/fatal_exit_check.c given a fatal note that never returns and a fault on another thread: the process ended with 71 after 30.5 s; with this change it ends with 70 after 30.5 s. That case takes 30 s, so the matrix gets a static check instead: tests/fatal_exit_check.py holds rt_ending_enter to storing the first caller's code and ending with it, fatal_end to passing its code, and crash_handler to its first line `if (!rt_ending_enter(71)) plat_exit(71);`. fatal_exit_check and the compile check of every runtime file (a header changed) pass, with no new -Wall warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,9 +62,10 @@ void rt_fatal_code(int code, const char *fmt, ...) __attribute__((noreturn, form
|
||||
// needs none. At most four; adding one twice keeps one. rt_fatal_notes runs them, once per process.
|
||||
void rt_fatal_note_add(void (*fn)(void));
|
||||
void rt_fatal_notes(void);
|
||||
// The one end of a failed run: the fatal error (rt_fatal) and the crash report (main.c crash_handler) call it first. 1
|
||||
// for the first caller, which reports and ends the process; 0 for that thread again (a failure inside its own report),
|
||||
// which ends at once with its code; any other thread waits, logging nothing, until the process ends (30 s at most).
|
||||
int rt_ending_enter(void);
|
||||
// The one end of a failed run: the fatal error (rt_fatal) and the crash report (main.c crash_handler) call it first,
|
||||
// with the code they end the process with. 1 for the first caller, which reports and ends the process; 0 for that
|
||||
// thread again (a failure inside its own report), which ends at once with its code; any other thread waits, logging
|
||||
// nothing, until the process ends, and after 30 s ends it with the first caller's code.
|
||||
int rt_ending_enter(int code);
|
||||
// HD rumble stopped before a failed run ends, on a thread of its own that the caller waits for 300 ms at most.
|
||||
void rt_rumble_stop_bounded(void);
|
||||
|
||||
Reference in New Issue
Block a user