mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 17:41:26 +08:00
Per https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain, it's not safe to clean up 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>
29 lines
636 B
C++
29 lines
636 B
C++
/*
|
|
* Copyright (C) 2024-2025 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "opencl/source/platform/platform.h"
|
|
|
|
namespace NEO {
|
|
volatile bool wasPlatformTeardownCalled = false;
|
|
|
|
void globalPlatformSetup() {
|
|
platformsImpl = new std::vector<std::unique_ptr<Platform>>;
|
|
}
|
|
|
|
void globalPlatformTeardown(bool processTermination) {
|
|
wasPlatformTeardownCalled = true;
|
|
if (processTermination) {
|
|
for (auto &platform : *platformsImpl) {
|
|
platform->devicesCleanup(processTermination);
|
|
}
|
|
return;
|
|
}
|
|
delete platformsImpl;
|
|
platformsImpl = nullptr;
|
|
}
|
|
} // namespace NEO
|