Skip to content

Commit 0eba939

Browse files
Correctly manage m_DebugWillSyncCount when thread exits before it is synchronized (#114917)
Co-authored-by: Tom McDonald <[email protected]>
1 parent 20e7f60 commit 0eba939

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/coreclr/vm/threads.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,6 +2896,12 @@ void Thread::OnThreadTerminate(BOOL holdingLock)
28962896

28972897
}
28982898

2899+
if (m_State & TS_DebugWillSync)
2900+
{
2901+
ResetThreadState(TS_DebugWillSync);
2902+
InterlockedDecrement(&m_DebugWillSyncCount);
2903+
}
2904+
28992905
SetThreadState(TS_Dead);
29002906
ThreadStore::s_pThreadStore->m_DeadThreadCount++;
29012907
ThreadStore::s_pThreadStore->IncrementDeadThreadCountForGCTrigger();

0 commit comments

Comments
 (0)