reabort = thread->m_StateNC & Thread::TSNC_DebuggerReAbort;
SENDIPCEVENT_END;
- // CONTEXT c;
- // c.ContextFlags = CONTEXT_DEBUG_REGISTERS;
- // thread->GetThreadContext(&c);
-
- // context->Dr7 = c.Dr7;
- // context->Dr0 = c.Dr0;
- // context->Dr1 = c.Dr1;
- // context->Dr2 = c.Dr2;
- // context->Dr3 = c.Dr3;
-
if (!atSafePlace)
g_pDebugger->DecThreadsAtUnsafePlaces();
#ifndef DACCESS_COMPILE
virtual void BeforeGarbageCollection();
virtual void AfterGarbageCollection();
- BOOL m_isBlockedOnGarbageCollectionEvent;
#endif
+ BOOL m_isBlockedOnGarbageCollectionEvent;
private:
HANDLE GetGarbageCollectionBlockerEvent() { return GetLazyData()->m_garbageCollectionBlockerEvent; }
LPCWSTR lpName
);
-#define SENDIPCEVENT_RAW_BEGIN_EX(pDbgLockHolder, gcxStmt) \
- { \
- ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_FOR_DEBUGGER); \
- Debugger::DebuggerLockHolder *__pDbgLockHolder = pDbgLockHolder; \
- gcxStmt; \
+#define SENDIPCEVENT_RAW_BEGIN_EX(pDbgLockHolder, gcxStmt) \
+ { \
+ ThreadStoreLockHolderWithSuspendReason tsld(ThreadSuspend::SUSPEND_FOR_DEBUGGER); \
+ Debugger::DebuggerLockHolder *__pDbgLockHolder = pDbgLockHolder; \
+ gcxStmt; \
g_pDebugger->LockForEventSending(__pDbgLockHolder);
-#define SENDIPCEVENT_RAW_END_EX \
- g_pDebugger->UnlockFromEventSending(__pDbgLockHolder); \
- ThreadStore::UnlockThreadStore(); \
+#define SENDIPCEVENT_RAW_END_EX \
+ g_pDebugger->UnlockFromEventSending(__pDbgLockHolder); \
}
#define SENDIPCEVENT_RAW_BEGIN(pDbgLockHolder) \
Debugger::DebuggerLockHolder __dbgLockHolder(pDebugger, FALSE); \
Debugger::DebuggerLockHolder *__pDbgLockHolder = &__dbgLockHolder; \
gcxStmt; \
- ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_FOR_DEBUGGER); \
+ ThreadStoreLockHolderWithSuspendReason tsld(ThreadSuspend::SUSPEND_FOR_DEBUGGER); \
g_pDebugger->LockForEventSending(__pDbgLockHolder); \
/* Check if the thread has been suspended by the debugger via SetDebugState(). */ \
if (thread != NULL && thread->HasThreadStateNC(Thread::TSNC_DebuggerUserSuspend)) \
; \
} \
g_pDebugger->UnlockFromEventSending(__pDbgLockHolder); \
- ThreadStore::UnlockThreadStore(); \
- } /* ~gcxStmt & ~DebuggerLockHolder */ \
+ } /* ~gcxStmt & ~DebuggerLockHolder & ~tsld */ \
} while (__fRetry); \
FireEtwDebugIPCEventEnd(); \
}
{
LOG((LF_CORDB, LL_INFO1000, "DRCT::ML:: straggler event set.\n"));
- ThreadStore::LockThreadStore();
+ ThreadStoreLockHolder tsl;
Debugger::DebuggerLockHolder debugLockHolder(m_debugger);
// Make sure that we're still synchronizing...
if (m_debugger->IsSynchronizing())
//
// Skip waiting the first time and just give it a go. Note: Implicit
- // release of the lock, because we are leaving its scope.
+ // release of the debugger and thread store lock, because we are leaving its scope.
//
- ThreadStore::UnlockThreadStore();
goto LWaitTimedOut;
}
#ifdef LOGGING
else
LOG((LF_CORDB, LL_INFO1000, "DRCT::ML:: told to wait, but not syncing anymore.\n"));
#endif
- ThreadStore::UnlockThreadStore();
// dbgLockHolder goes out of scope - implicit Release
+ // tsl goes out of scope - implicit Release
}
else if (dwWaitResult == WAIT_TIMEOUT)
{
static LONG m_DebugWillSyncCount;
};
+// void(*)(BOOL,ThreadSuspend::SUSPEND_REASON)
+
+class ThreadStoreLockHolderWithSuspendReason
+{
+public:
+ ThreadStoreLockHolderWithSuspendReason(ThreadSuspend::SUSPEND_REASON reason)
+ {
+ ThreadSuspend::LockThreadStore(reason);
+ }
+ ~ThreadStoreLockHolderWithSuspendReason()
+ {
+ ThreadSuspend::UnlockThreadStore();
+ }
+private:
+ ThreadSuspend::SUSPEND_REASON m_reason;
+};
+
#endif // _THREAD_SUSPEND_H_