diff --git a/src/coreclr/inc/predeftlsslot.h b/src/coreclr/inc/predeftlsslot.h index 9ac1402589c5c..b84d112558a2a 100644 --- a/src/coreclr/inc/predeftlsslot.h +++ b/src/coreclr/inc/predeftlsslot.h @@ -22,17 +22,17 @@ enum PredefinedTlsSlots enum TlsThreadTypeFlag // flag used for thread type in Tls data { ThreadType_GC = 0x00000001, - ThreadType_Timer = 0x00000002, - ThreadType_Gate = 0x00000004, + // ThreadType_Timer = 0x00000002, + // ThreadType_Gate = 0x00000004, ThreadType_DbgHelper = 0x00000008, ThreadType_Shutdown = 0x00000010, ThreadType_DynamicSuspendEE = 0x00000020, ThreadType_Finalizer = 0x00000040, - ThreadType_ADUnloadHelper = 0x00000200, - ThreadType_ShutdownHelper = 0x00000400, - ThreadType_Threadpool_IOCompletion = 0x00000800, - ThreadType_Threadpool_Worker = 0x00001000, - ThreadType_Wait = 0x00002000, + // ThreadType_ADUnloadHelper = 0x00000200, + // ThreadType_ShutdownHelper = 0x00000400, + // ThreadType_Threadpool_IOCompletion = 0x00000800, + // ThreadType_Threadpool_Worker = 0x00001000, + // ThreadType_Wait = 0x00002000, ThreadType_ProfAPI_Attach = 0x00004000, ThreadType_ProfAPI_Detach = 0x00008000, ThreadType_ETWRundownThread = 0x00010000, diff --git a/src/coreclr/inc/utilcode.h b/src/coreclr/inc/utilcode.h index 192bdc5d0d597..5fef649852658 100644 --- a/src/coreclr/inc/utilcode.h +++ b/src/coreclr/inc/utilcode.h @@ -3431,16 +3431,6 @@ inline BOOL IsGCSpecialThread () return !!(t_ThreadType & ThreadType_GC); } -// check if current thread is a Gate thread -inline BOOL IsGateSpecialThread () -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_MODE_ANY; - - return !!(t_ThreadType & ThreadType_Gate); -} - // check if current thread is a debugger helper thread inline BOOL IsDbgHelperSpecialThread () { @@ -3481,33 +3471,6 @@ inline BOOL IsShutdownSpecialThread () return !!(t_ThreadType & ThreadType_Shutdown); } -inline BOOL IsThreadPoolIOCompletionSpecialThread () -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_MODE_ANY; - - return !!(t_ThreadType & ThreadType_Threadpool_IOCompletion); -} - -inline BOOL IsThreadPoolWorkerSpecialThread () -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_MODE_ANY; - - return !!(t_ThreadType & ThreadType_Threadpool_Worker); -} - -inline BOOL IsWaitSpecialThread () -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_MODE_ANY; - - return !!(t_ThreadType & ThreadType_Wait); -} - // check if current thread is a thread which is performing shutdown inline BOOL IsSuspendEEThread () { @@ -3527,15 +3490,6 @@ inline BOOL IsFinalizerThread () return !!(t_ThreadType & ThreadType_Finalizer); } -inline BOOL IsShutdownHelperThread () -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_MODE_ANY; - - return !!(t_ThreadType & ThreadType_ShutdownHelper); -} - inline BOOL IsProfilerAttachThread () { STATIC_CONTRACT_NOTHROW; diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 68e2d80935c40..5e88929ac7289 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -683,22 +683,6 @@ Thread* SetupThread() // thread spinning up. if (pThread) { - if (IsThreadPoolWorkerSpecialThread()) - { - pThread->SetThreadState(Thread::TS_TPWorkerThread); - pThread->SetBackground(TRUE); - } - else if (IsThreadPoolIOCompletionSpecialThread()) - { - pThread->SetThreadState(Thread::TS_CompletionPortThread); - pThread->SetBackground(TRUE); - } - else if (IsWaitSpecialThread()) - { - pThread->SetThreadState(Thread::TS_TPWorkerThread); - pThread->SetBackground(TRUE); - } - BOOL fStatus = pThread->HasStarted(); ensurePreemptive.SuppressRelease(); return fStatus ? pThread : NULL; @@ -775,19 +759,6 @@ Thread* SetupThread() ensurePreemptive.SuppressRelease(); - if (IsThreadPoolWorkerSpecialThread()) - { - pThread->SetThreadState(Thread::TS_TPWorkerThread); - } - else if (IsThreadPoolIOCompletionSpecialThread()) - { - pThread->SetThreadState(Thread::TS_CompletionPortThread); - } - else if (IsWaitSpecialThread()) - { - pThread->SetThreadState(Thread::TS_TPWorkerThread); - } - #ifdef FEATURE_EVENT_TRACE ETW::ThreadLog::FireThreadCreated(pThread); #endif // FEATURE_EVENT_TRACE diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index 1ae521b87d54b..656fc5fd44e68 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -644,7 +644,7 @@ class Thread TS_Interruptible = 0x02000000, // sitting in a Sleep(), Wait(), Join() TS_Interrupted = 0x04000000, // was awakened by an interrupt APC. !!! This can be moved to TSNC - TS_CompletionPortThread = 0x08000000, // Completion port thread + // unused TS_AbortInitiated = 0x10000000, // set when abort is begun @@ -1882,7 +1882,7 @@ class Thread BOOL IsThreadPoolThread() { LIMITED_METHOD_CONTRACT; - return m_State & (Thread::TS_TPWorkerThread | Thread::TS_CompletionPortThread); + return m_State & Thread::TS_TPWorkerThread; } void SetIsThreadPoolThread() diff --git a/src/coreclr/vm/util.cpp b/src/coreclr/vm/util.cpp index d03ecb7326073..2065677ed810e 100644 --- a/src/coreclr/vm/util.cpp +++ b/src/coreclr/vm/util.cpp @@ -28,12 +28,7 @@ void ClrFlsSetThreadType(TlsThreadTypeFlag flag) // The historic location of ThreadType slot kept for compatibility with SOS // TODO: Introduce DAC API to make this hack unnecessary -#if defined(_MSC_VER) && defined(HOST_X86) - // Workaround for https://developercommunity.visualstudio.com/content/problem/949233/tls-relative-fixup-overflow-tls-section-is-too-lar.html - gCurrentThreadInfo.m_EETlsData = (void**)(((size_t)&t_ThreadType ^ 1) - (4 * TlsIdx_ThreadType + 1)); -#else gCurrentThreadInfo.m_EETlsData = (void**)&t_ThreadType - TlsIdx_ThreadType; -#endif } void ClrFlsClearThreadType(TlsThreadTypeFlag flag)