From b16fa2e7111dc4dc1d9d987bd5dcbf89c82b9ee8 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Sun, 29 Dec 2019 15:08:13 -0500 Subject: [PATCH] win32: Don't run cleanup if we're about to exit anyway If the process is about to exit, there's no point trying to do a bunch of work to clean up resources. The kernel will release them much more efficiently when the process exits at the end of this function. --- exports/dllinit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exports/dllinit.c b/exports/dllinit.c index 4a05c0e14..88f9af658 100644 --- a/exports/dllinit.c +++ b/exports/dllinit.c @@ -50,7 +50,10 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { gotoblas_init(); break; case DLL_PROCESS_DETACH: - gotoblas_quit(); + // If the process is about to exit, don't bother releasing any resources + // The kernel is much better at bulk releasing then. + if (!reserved) + gotoblas_quit(); break; case DLL_THREAD_ATTACH: break;