From 0aaf0a793e95fbef99c2c7e7e68fb3e1e91adcff Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 4 Sep 2015 10:16:37 +0200 Subject: Remove thread affinity and critical region stuff for Unix The WaitHandleNative::CorWaitMultipleNative was calling Thread::BeginThreadAffinityAndCriticalRegion that results in incrementing the Thread::m_dwCriticalRegionCount. However, there is nothing that would decrement it on CoreCLR, so if the WaitHandleNative::CorWaitMultipleNative is called, in debug build we get an assert in Thread::InternalReset. It turns out that the critical region and thread affinity stuff is not to be used in CoreCLR, so I have disabled handling of that in CoreCLR for Unix. The only remainder are the static methods Thread::BeginThreadAffinity and Thread::EndThreadAffinity which are used in the ThreadAffinityHolder. Conditionally removing the holder usage would be messy, so I have rather kept those methods and made their bodies empty. --- src/vm/frames.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/vm/frames.h') diff --git a/src/vm/frames.h b/src/vm/frames.h index ce65b38623..dcaa4403ff 100644 --- a/src/vm/frames.h +++ b/src/vm/frames.h @@ -3165,8 +3165,9 @@ private: PTR_Object m_LastThrownObjectInParentContext; ULONG_PTR m_LockCount; // Number of locks the thread takes // before the transition. +#ifndef FEATURE_CORECLR ULONG_PTR m_CriticalRegionCount; - +#endif // !FEATURE_CORECLR VPTR_VTABLE_CLASS(ContextTransitionFrame, Frame) public: @@ -3194,18 +3195,29 @@ public: m_LastThrownObjectInParentContext = OBJECTREFToObject(lastThrownObject); } - void SetLockCount(DWORD lockCount, DWORD criticalRegionCount) + void SetLockCount(DWORD lockCount) { LIMITED_METHOD_CONTRACT; m_LockCount = lockCount; + } + DWORD GetLockCount() + { + LIMITED_METHOD_CONTRACT; + return (DWORD) m_LockCount; + } + +#ifndef FEATURE_CORECLR + void SetCriticalRegionCount(DWORD criticalRegionCount) + { + LIMITED_METHOD_CONTRACT; m_CriticalRegionCount = criticalRegionCount; } - void GetLockCount(DWORD* pLockCount, DWORD* pCriticalRegionCount) + DWORD GetCriticalRegionCount() { LIMITED_METHOD_CONTRACT; - *pLockCount = (DWORD) m_LockCount; - *pCriticalRegionCount = (DWORD) m_CriticalRegionCount; + return (DWORD) m_CriticalRegionCount; } +#endif // !FEATURE_CORECLR // Let debugger know that we're transitioning between AppDomains. ETransitionType GetTransitionType() @@ -3220,7 +3232,9 @@ public: , m_ReturnExecutionContext(NULL) , m_LastThrownObjectInParentContext(NULL) , m_LockCount(0) +#ifndef FEATURE_CORECLR , m_CriticalRegionCount(0) +#endif // !FEATURE_CORECLR { LIMITED_METHOD_CONTRACT; } -- cgit v1.2.3