diff --git a/source/lib/ze_lib.cpp b/source/lib/ze_lib.cpp index 2046f5fa..2e9ca7c7 100644 --- a/source/lib/ze_lib.cpp +++ b/source/lib/ze_lib.cpp @@ -156,6 +156,8 @@ namespace ze_lib std::string version_message = "Loader API Version to be requested is v" + std::to_string(ZE_MAJOR_VERSION(version)) + "." + std::to_string(ZE_MINOR_VERSION(version)); debug_trace_message(version_message, ""); loaderDriverGet = reinterpret_cast(GET_FUNCTION_PTR(loader, "zeDriverGet")); + checkIsLoaderInTearDown = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zelCheckIsLoaderInTearDown")); #else result = zeLoaderInit(); if( ZE_RESULT_SUCCESS == result ) { @@ -497,6 +499,9 @@ zelCheckIsLoaderInTearDown() { return true; } #if defined(DYNAMIC_LOAD_LOADER) && defined(_WIN32) + if (ze_lib::context->checkIsLoaderInTearDown) { + return ze_lib::context->checkIsLoaderInTearDown(); + } std::promise stabilityPromise; std::future resultFuture = stabilityPromise.get_future(); int result = -1; diff --git a/source/lib/ze_lib.h b/source/lib/ze_lib.h index f4a2bad8..7fccd6f8 100644 --- a/source/lib/ze_lib.h +++ b/source/lib/ze_lib.h @@ -27,6 +27,7 @@ namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// + typedef bool (ZE_APICALL *zelCheckIsLoaderInTearDown_t)(); class __zedlllocal context_t { public: @@ -175,6 +176,7 @@ namespace ze_lib bool debugTraceEnabled = false; bool dynamicTracingSupported = true; ze_pfnDriverGet_t loaderDriverGet = nullptr; + zelCheckIsLoaderInTearDown_t checkIsLoaderInTearDown = nullptr; }; extern bool destruction;