runtime: own the executable TLS exit callback #2315
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2315
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2315"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ZroIsHere on GitHub · 2026-11-26 13:45 UTC · original
ZroIsHere:fix/thread-local-exe-atexit-callback→main· +48 −6 · 4 files · 1 commits · merged 2026-11-26 18:30 UTCDuring boot, the executable's
_register_thread_local_exe_atexit_callbackimport reached the host UCRT and terminated the process withFAST_FAIL_FATAL_APP_EXITbefore D3D12 initialization.Bind the callback to the runtime. Run it after the executable's TLS thread-detach callbacks and before normal CRT exit parks the game thread.
_Exit,quick_exit,ExitProcessandabortcontinue to skip CRT cleanup.Validation: the Windows/MSVC RelWithDebInfo
gta6rtbuild passed. With the Vulkan backend, translated shaders and a scripted GameInput pad for the no-SDL build, the retail package rendered non-black 3840×2160 frames and reached the Spanish onboarding UI. Captures are in_build/thread-local-shaderboot9/captures(frame_01501andframe_02001). No tests were run.@aslan2142 on GitHub · 2026-11-26 18:30 UTC · original
Merged through the integration PR #2395, together with #2372.
Changed on top, in one maintainer commit:
_tls_callback_type(void (__stdcall*)(void*, unsigned long, void*)in UCRTprocess.h), as(nullptr, DLL_PROCESS_DETACH, nullptr). Before, it was called asvoid (*)(), so the reason argument vcruntime reads was whateverrdxheld.exitand_cexitcall it before the atexit handlers, as the UCRT does: the leaving thread'sthread_localobjects end before the static ones.run_tiny_atexithas two new modes,thread_local_exitandthread_local_cexit. They fail onmainand pass with the change.Thank you for finding the fast-fail on the second registration. It stopped the title at boot on Windows.
AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)