(pEvent->type & DB_IPCE_TYPE_MASK) == DB_IPCE_ATTACHING ||
this->m_isBlockedOnGarbageCollectionEvent)
{
- lockedThreadStore = true;
- ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_FOR_DEBUGGER);
+ if (!this->m_isBlockedOnGarbageCollectionEvent)
+ {
+ lockedThreadStore = true;
+ ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_FOR_DEBUGGER);
+ }
dbgLockHolder.Acquire();
}
else
DISABLED(GC_TRIGGERS); // WaitUntilConcurrentGCComplete toggle GC mode, disabled because called by unmanaged thread
// We assume that only the "real" helper thread ever calls this (not somebody doing helper thread duty).
+ PRECONDITION(ThreadStore::HoldingThreadStore());
PRECONDITION(IsDbgHelperSpecialThread());
PRECONDITION(GetThread() == NULL);
// Iff we return true, then we have the TSL (or the aux lock used in workarounds).
- POSTCONDITION(RETVAL == !!ThreadStore::HoldingThreadStore());
+ POSTCONDITION(ThreadStore::HoldingThreadStore());
}
CONTRACT_END;
// This function has parallel logic in SuspendRuntime. Please make
// sure to make appropriate changes there as well.
- bool alreadyHeldThreadStoreLock = ThreadStore::HoldingThreadStore();
- if (!alreadyHeldThreadStoreLock)
- {
- // We use ThreadSuspend::SUSPEND_FOR_DEBUGGER_SWEEP here to avoid a deadlock which
- // can occur due to the s_hAbortEvt event. This event causes any thread trying
- // to take the ThreadStore lock to wait for a GC to complete. If a thread is
- // in SuspendEE for a GC and suspends for the debugger, then this thread will
- // deadlock if we do not pass in SUSPEND_FOR_DEBUGGER_SWEEP here.
- ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_FOR_DEBUGGER_SWEEP);
- }
-
// From this point until the end of the function, consider all active thread
// suspension to be in progress. This is mainly to give the profiler API a hint
// that trying to suspend a thread (in order to walk its stack) could delay the
// The CLR is not yet synced. We release the threadstore lock and return false.
hldSuspendRuntimeInProgress.Release();
- if (!alreadyHeldThreadStoreLock)
- {
- ThreadSuspend::UnlockThreadStore();
- }
RETURN false;
}