From 1f155191523a51c059c03a4fa33e34ec93dfc3d8 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 27 Sep 2016 10:43:59 +0200 Subject: [PATCH] [w32handle] Ensure we initialize begore the gc attach the current thread (#3644) --- mono/metadata/boehm-gc.c | 4 ++++ mono/metadata/null-gc.c | 4 ++++ mono/metadata/sgen-mono.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index d22f162085b..e7ee0517dd2 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -111,6 +111,10 @@ mono_gc_base_init (void) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + /* * Handle the case when we are called from a thread different from the main thread, * confusing libgc. diff --git a/mono/metadata/null-gc.c b/mono/metadata/null-gc.c index 1ab1e0ebb2d..0f47c00fa62 100644 --- a/mono/metadata/null-gc.c +++ b/mono/metadata/null-gc.c @@ -26,6 +26,10 @@ mono_gc_base_init (void) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + memset (&cb, 0, sizeof (cb)); /* TODO: This casts away an incompatible pointer type warning in the same manner that boehm-gc does it. This is probably worth investigating diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index fdbc46a2cfb..4b6a5d355ef 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -2970,6 +2970,10 @@ mono_gc_base_init (void) mono_counters_init (); +#ifndef HOST_WIN32 + mono_w32handle_init (); +#endif + #ifdef HEAVY_STATISTICS mono_counters_register ("los marked cards", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &los_marked_cards); mono_counters_register ("los array cards scanned ", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &los_array_cards); -- 2.25.1