summaryrefslogtreecommitdiff
path: root/src/gc
diff options
context:
space:
mode:
authorMaoni Stephens <Maoni0@users.noreply.github.com>2017-10-27 17:36:57 -0700
committerGitHub <noreply@github.com>2017-10-27 17:36:57 -0700
commit5b02b0104f3ceba491b7b25fcb4d997e477d2840 (patch)
tree605bb564e32fbedc9a978263077338d17482bea8 /src/gc
parentcffb9f4dc658d3a44f5ed9394195dcf00a534b5f (diff)
downloadcoreclr-5b02b0104f3ceba491b7b25fcb4d997e477d2840.tar.gz
coreclr-5b02b0104f3ceba491b7b25fcb4d997e477d2840.tar.bz2
coreclr-5b02b0104f3ceba491b7b25fcb4d997e477d2840.zip
Don't wake up other GC threads when we decide to not proceed with the GC (#14719)
Diffstat (limited to 'src/gc')
-rw-r--r--src/gc/gc.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 7df1911668..042f2f4929 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -5401,9 +5401,11 @@ void gc_heap::gc_thread_function ()
proceed_with_gc_p = FALSE;
}
else
+ {
settings.init_mechanisms();
+ gc_start_event.Set();
+ }
dprintf (3, ("%d gc thread waiting...", heap_number));
- gc_start_event.Set();
}
else
{
@@ -5411,6 +5413,8 @@ void gc_heap::gc_thread_function ()
dprintf (3, ("%d gc thread waiting... Done", heap_number));
}
+ assert ((heap_number == 0) || proceed_with_gc_p);
+
if (proceed_with_gc_p)
garbage_collect (GCHeap::GcCondemnedGeneration);
@@ -5447,7 +5451,18 @@ void gc_heap::gc_thread_function ()
gc_heap::internal_gc_done = true;
- set_gc_done();
+ if (proceed_with_gc_p)
+ set_gc_done();
+ else
+ {
+ // If we didn't actually do a GC, it means we didn't wait up the other threads,
+ // we still need to set the gc_done_event for those threads.
+ for (int i = 0; i < gc_heap::n_heaps; i++)
+ {
+ gc_heap* hp = gc_heap::g_heaps[i];
+ hp->set_gc_done();
+ }
+ }
}
else
{