* dso/win32/dso.c
(apr_dso_load): Use SetThreadErrorMode() instead of SetErrorMode(), because
SetErrorMode() is not thread-safe.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1859519 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dso/win32/dso.c b/dso/win32/dso.c
index 3433c7e..9681d91 100644
--- a/dso/win32/dso.c
+++ b/dso/win32/dso.c
@@ -69,7 +69,10 @@
}
/* Prevent ugly popups from killing our app */
#ifndef _WIN32_WCE
- em = SetErrorMode(SEM_FAILCRITICALERRORS);
+ if (!SetThreadErrorMode(SEM_FAILCRITICALERRORS, &em)) {
+ *res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
+ return ((*res_handle)->load_error = apr_get_os_error());
+ }
#endif
os_handle = LoadLibraryExW(wpath, NULL, 0);
if (!os_handle)
@@ -87,7 +90,7 @@
#endif
}
#ifndef _WIN32_WCE
- SetErrorMode(em);
+ SetThreadErrorMode(em, NULL);
#endif
*res_handle = apr_pcalloc(ctx, sizeof(**res_handle));