File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ void *pthread_get_stackaddr_np(pthread_t);
60
60
61
61
static gboolean gc_initialized = FALSE;
62
62
static gboolean gc_strict_wbarriers = FALSE;
63
+ static gboolean gc_dont_gc_env = FALSE;
63
64
static mono_mutex_t mono_gc_lock ;
64
65
65
66
typedef void (* GC_push_other_roots_proc )(void );
@@ -208,6 +209,9 @@ mono_gc_base_init (void)
208
209
g_free (debug_opts );
209
210
}
210
211
212
+ /* cache value rather than calling during collection since g_hasenv may take locks and can deadlock */
213
+ gc_dont_gc_env = g_hasenv ("GC_DONT_GC" );
214
+
211
215
GC_init ();
212
216
213
217
GC_set_warn_proc (mono_gc_warning );
@@ -1539,7 +1543,7 @@ mono_gc_is_moving (void)
1539
1543
gboolean
1540
1544
mono_gc_is_disabled (void )
1541
1545
{
1542
- if (GC_dont_gc || g_hasenv ( "GC_DONT_GC" ) )
1546
+ if (GC_dont_gc || gc_dont_gc_env )
1543
1547
return TRUE;
1544
1548
else
1545
1549
return FALSE;
You can’t perform that action at this time.
0 commit comments