Skip to content

Commit 6cc557e

Browse files
author
Maoni0
committed
fixing an assert
1 parent 6df7807 commit 6cc557e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6999,8 +6999,21 @@ void gc_heap::gc_thread_function ()
69996999

70007000
while (1)
70017001
{
7002-
// inactive GC threads may observe gc_t_join.joined() being true here
7003-
assert ((n_heaps <= heap_number) || !gc_t_join.joined());
7002+
#ifdef DYNAMIC_HEAP_COUNT
7003+
if (gc_heap::dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)
7004+
{
7005+
// Inactive GC threads may observe gc_t_join.joined() being true here.
7006+
// Before the 1st GC happens, h0's GC thread can also observe gc_t_join.joined() being true because it's
7007+
// also inactive as the main thread (that inits the GC) will act as h0 (to call change_heap_count).
7008+
assert (((heap_number == 0) && (VolatileLoadWithoutBarrier (&settings.gc_index) == 0)) ||
7009+
(n_heaps <= heap_number) ||
7010+
!gc_t_join.joined());
7011+
}
7012+
else
7013+
#endif //DYNAMIC_HEAP_COUNT
7014+
{
7015+
assert (!gc_t_join.joined());
7016+
}
70047017

70057018
if (heap_number == 0)
70067019
{

0 commit comments

Comments
 (0)