From 2e0dcd7f57ccc9aab0fec0b017f693ce6e64ae40 Mon Sep 17 00:00:00 2001 From: Avijit Singh Date: Mon, 12 Oct 2026 00:19:27 +0530 Subject: [PATCH] docs(agc): record write tracker shutdown ordering Document why the Driver singleton must initialize the guest write tracker before its static construction completes on Windows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/dev/TechnicalDebt.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index 0c72b62a7..9863562e2 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -9,6 +9,10 @@ - libwinpthread-1.dll - winpthreads initializes a statically initialized rwlock on its first lock and fails a concurrent first lock with `EINVAL`, which `std::shared_mutex` and `std::shared_timed_mutex` ignore, so that lock does not exclude. Guest rwlocks ([Pthread.hpp](../../core/libs/prx/libkernel/Pthread/include/Pthread.hpp)) are locked once when created. The host `std::shared_mutex` objects in [Recompiler.cpp](../../core/shader/recompiler/Recompiler.cpp) and [GuestWriteWatch.cpp](../../core/libs/prx/libc/src/GuestWriteWatch.cpp) are not, and can still race on their first contended use. +### Shutdown + +- On Windows, console-control termination can run function-local static destructors through `ExitProcess`. `Driver::~Driver()` stops GPU state, which can access the guest write tracker. `Driver::Driver()` therefore initializes the tracker before the `Driver` singleton finishes construction, so reverse static-destruction order keeps the tracker alive through driver teardown. + ### Silent stubs Throughout the project, every function at every stage either **does exactly what it's supposed to or throws an exception**. Everywhere... except: