Implement signal handler tail recursion

GNU Make on Windows now appears to be working reliably. This change also
fixes a bug where, after fork the Windows thread handle wasn't reset and
that caused undefined behavior using SetThreadContext() with our signals
This commit is contained in:
Justine Tunney 2023-10-14 10:29:26 -07:00
parent a657f3e878
commit cdf556e7d2
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
15 changed files with 627 additions and 77 deletions

View file

@ -395,6 +395,7 @@ textwindows int sys_fork_nt(uint32_t dwCreationFlags) {
__set_tls(tib);
__morph_tls();
__tls_enabled_set(true);
// get new main thread handle
// clear pending signals
tib->tib_sigpending = 0;
atomic_store_explicit(&__sig.pending, 0, memory_order_relaxed);
@ -404,9 +405,9 @@ textwindows int sys_fork_nt(uint32_t dwCreationFlags) {
if (ftrace_stackdigs) {
_weaken(__hook)(_weaken(ftrace_hook), _weaken(GetSymbolTable)());
}
// reset console
// reset core runtime services
__proc_wipe();
__keystroke_wipe();
// reset alarms
if (_weaken(__itimer_wipe)) {
_weaken(__itimer_wipe)();
}