@@ -2113,18 +2113,9 @@ void Thread::RareDisablePreemptiveGC()
2113
2113
// Note IsGCInProgress is also true for say Pause (anywhere SuspendEE happens) and GCThread is the
2114
2114
// thread that did the Pause. While in Pause if another thread attempts Rev/Pinvoke it should get inside the following and
2115
2115
// block until resume
2116
- if ((
2117
- (GCHeapUtilities::IsGCInProgress () && (this != ThreadSuspend::GetSuspensionThread ())) ||
2118
- (m_State & TS_DebugSuspendPending) ||
2119
- (m_State & TS_StackCrawlNeeded)
2120
- ) &&
2121
-
2122
- // When in a forbid-suspend-for-debugger region and the thread waits for an in-progress GC, it would become stuck in the
2123
- // forbid region until the GC is complete. In the meantime, the debugger may need to have the runtime suspend for the
2124
- // debugger first, perhaps in a GC-unsafe point. This thread would not be able to suspend for the debugger and would
2125
- // cause a deadlock during debugger suspension. When in the forbid region, allow disabling preemptive GC and bypass the
2126
- // above heuristics.
2127
- !IsInForbidSuspendForDebuggerRegion ())
2116
+ if ((GCHeapUtilities::IsGCInProgress () && (this != ThreadSuspend::GetSuspensionThread ())) ||
2117
+ ((m_State & TS_DebugSuspendPending) && !IsInForbidSuspendForDebuggerRegion ()) ||
2118
+ (m_State & TS_StackCrawlNeeded))
2128
2119
{
2129
2120
STRESS_LOG1 (LF_SYNC, LL_INFO1000, " RareDisablePreemptiveGC: entering. Thread state = %x\n " , m_State.Load ());
2130
2121
@@ -2190,10 +2181,9 @@ void Thread::RareDisablePreemptiveGC()
2190
2181
// However, it is possible for the current thread to become the GC
2191
2182
// thread while in this loop. This happens if you use the COM+
2192
2183
// debugger to suspend this thread and then release it.
2193
- _ASSERTE (!IsInForbidSuspendForDebuggerRegion ());
2194
2184
if (! ((GCHeapUtilities::IsGCInProgress () && (this != ThreadSuspend::GetSuspensionThread ())) ||
2195
- ( m_State & TS_DebugSuspendPending) ||
2196
- (m_State & TS_StackCrawlNeeded)) )
2185
+ (( m_State & TS_DebugSuspendPending) && ! IsInForbidSuspendForDebuggerRegion () ) ||
2186
+ (m_State & TS_StackCrawlNeeded)) )
2197
2187
{
2198
2188
break ;
2199
2189
}
0 commit comments