Skip to content

Commit

Permalink
Fix SegmentResortChains synchronization (#107468)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisAhna committed Sep 6, 2024
1 parent d1ecd63 commit 1c4755d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/coreclr/gc/handletablescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,14 @@ PTR_TableSegment CALLBACK StandardSegmentIterator(PTR_HandleTable pTable, PTR_Ta
#ifndef DACCESS_COMPILE
// re-sort the block chains if necessary
if (pNextSegment && pNextSegment->fResortChains)
{
// Since this operation can rewrite segment state, it needs to synchronize with any racing
// threads that might be concurrently allocating null handle table slots while running in
// preemptive mode (which happens, e.g., during Thread construction when a native thread
// first enters the runtime).
CrstHolder ch(&pTable->Lock);
SegmentResortChains(pNextSegment);
}
#endif

// return the segment we found
Expand Down

0 comments on commit 1c4755d

Please sign in to comment.