mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix: skip cleanup in L0 DllMain when terminating process
Per https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain, it's not safe to cleanup resources in DllMain when fdwReason == DLL_PROCESS_DETACH and lpvReserved != NULL (the process is terminating), e.g. can result in a hang in some cases. Related-To: NEO-14121 Signed-off-by: Oskar Hubert Weber <oskar.hubert.weber@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e4681ddafa
commit
b70c7fd078
@@ -17,10 +17,14 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
L0::globalDriverSetup();
|
||||
}
|
||||
if (fdwReason == DLL_PROCESS_DETACH) {
|
||||
L0::globalDriverTeardown();
|
||||
if (L0::globalOsSysmanDriver != nullptr) {
|
||||
delete L0::globalOsSysmanDriver;
|
||||
L0::globalOsSysmanDriver = nullptr;
|
||||
/* If lpvReserved is non-NULL with DLL_PROCESS_DETACH, the process is terminating,
|
||||
* cleanup should be skipped according to the DllMain spec. */
|
||||
if (!lpvReserved) {
|
||||
L0::globalDriverTeardown();
|
||||
if (L0::globalOsSysmanDriver != nullptr) {
|
||||
delete L0::globalOsSysmanDriver;
|
||||
L0::globalOsSysmanDriver = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user