Caching settings.pause_mode to avoid deadlock (#84189)
authorAndrew Au <andrewau@microsoft.com>
Wed, 5 Apr 2023 18:25:30 +0000 (11:25 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2023 18:25:30 +0000 (11:25 -0700)
src/coreclr/gc/gc.cpp

index 5f48210..82d552d 100644 (file)
@@ -22628,6 +22628,8 @@ void gc_heap::garbage_collect_pm_full_gc()
 
 void gc_heap::garbage_collect (int n)
 {
+    gc_pause_mode saved_settings_pause_mode = settings.pause_mode;
+
     //reset the number of alloc contexts
     alloc_contexts_used = 0;
 
@@ -23033,7 +23035,7 @@ void gc_heap::garbage_collect (int n)
 #endif //MULTIPLE_HEAPS
 
 done:
-    if (settings.pause_mode == pause_no_gc)
+    if (saved_settings_pause_mode == pause_no_gc)
         allocate_for_no_gc_after_gc();
 }