From d864e090cc0e292a1eda2ec0433f1b19a0ad01ec Mon Sep 17 00:00:00 2001 From: Jay Krell Date: Wed, 29 May 2019 16:29:48 -0700 Subject: [PATCH] Do not change Win32 lasterror in the first MONO_EXIT_GC_SAFE. Commit migrated from https://github.com/mono/mono/commit/c5a628e86f4a4acff36e10cd768b36ec3cc4e18d --- src/mono/mono/utils/mono-threads-coop.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mono/mono/utils/mono-threads-coop.c b/src/mono/mono/utils/mono-threads-coop.c index 3c8c9d3..52dfc81 100644 --- a/src/mono/mono/utils/mono-threads-coop.c +++ b/src/mono/mono/utils/mono-threads-coop.c @@ -648,10 +648,16 @@ mono_threads_suspend_policy (void) // otherwise if there's a compiled-in default, use it. // otherwise if one of the old environment variables is set, use that. // otherwise use full preemptive suspend. + + W32_DEFINE_LAST_ERROR_RESTORE_POINT; + (policy = threads_suspend_policy_getenv ()) || (policy = threads_suspend_policy_default ()) || (policy = threads_suspend_policy_getenv_compat ()) || (policy = MONO_THREADS_SUSPEND_FULL_PREEMPTIVE); + + W32_RESTORE_LAST_ERROR_FROM_RESTORE_POINT; + g_assert (policy); threads_suspend_policy = (char)policy; } -- 2.7.4