From 19da949dbc1e462e8404799b9218754cf571c8d0 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 26 Sep 2024 03:30:51 -0700 Subject: [PATCH] Delete dead code (#108265) --- src/coreclr/inc/corexcep.h | 4 ---- src/coreclr/vm/threads.cpp | 38 ++------------------------------------ src/coreclr/vm/threads.h | 6 ------ 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/coreclr/inc/corexcep.h b/src/coreclr/inc/corexcep.h index e1c00b50b3217..c5a412496b000 100644 --- a/src/coreclr/inc/corexcep.h +++ b/src/coreclr/inc/corexcep.h @@ -28,8 +28,4 @@ // stress to facilitate failure triaging. #endif -// This is the exception code to report SetupThread failure to caller of reverse pinvoke -// It is misleading to use our COM+ exception code, since this is not a managed exception. -// In the end, we picked e0455858 (EXX). -#define EXCEPTION_EXX 0xe0455858 // 0xe0000000 | 'EXX' #endif // __COREXCEP_H__ diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 92ca9f9ede48a..60de80e15660c 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -961,32 +961,6 @@ DWORD GetRuntimeId() #endif } -//--------------------------------------------------------------------------- -// Creates new Thread for reverse p-invoke calls. -//--------------------------------------------------------------------------- -Thread* WINAPI CreateThreadBlockThrow() -{ - - WRAPPER_NO_CONTRACT; - - // This is a workaround to disable our check for throwing exception in SetupThread. - // We want to throw an exception for reverse p-invoke, and our assertion may fire if - // a unmanaged caller does not setup an exception handler. - CONTRACT_VIOLATION(ThrowsViolation); // WON'T FIX - This enables catastrophic failure exception in reverse P/Invoke - the only way we can communicate an error to legacy code. - - HRESULT hr = S_OK; - Thread* pThread = SetupThreadNoThrow(&hr); - if (pThread == NULL) - { - // Creating Thread failed, and we need to throw an exception to report status. - // It is misleading to use our COM+ exception code, since this is not a managed exception. - ULONG_PTR arg = hr; - RaiseException(EXCEPTION_EXX, 0, 1, &arg); - } - - return pThread; -} - #ifdef _DEBUG DWORD_PTR Thread::OBJREF_HASH = OBJREF_TABSIZE; #endif @@ -2187,19 +2161,11 @@ BOOL Thread::CreateNewOSThread(SIZE_T sizeToCommitOrReserve, LPTHREAD_START_ROUT // object. We also place a reference count on it when we construct it, and we lose // that count when the thread finishes doing useful work (OnThreadTerminate). // -// One way OnThreadTerminate() is called is when the thread finishes doing useful -// work. This case always happens on the correct thread. -// -// The other way OnThreadTerminate() is called is during product shutdown. We do -// a "best effort" to eliminate all threads except the Main thread before shutdown -// happens. But there may be some background threads or external threads still -// running. +// OnThreadTerminate() is called is when the thread finishes doing useful +// work. // // When the final reference count disappears, we destruct. Until then, the thread // remains in the ThreadStore, but is marked as "Dead". -// -// @TODO cwb: for a typical shutdown, only background threads are still around. -// Should we interrupt them? What about the non-typical shutdown? int Thread::IncExternalCount() { diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index dc349b02c7122..aca4905e419c0 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -294,10 +294,6 @@ const CLONE_QUEUE_USER_APC_FLAGS SpecialUserModeApcWithContextFlags = // void DetachThread() - the underlying logical thread is going // away but we don't want to destroy it yet. // -// Public functions for ASM code generators -// -// Thread* __stdcall CreateThreadBlockThrow() - creates new Thread on reverse p-invoke -// // Public functions for one-time init/cleanup // // void InitThreadManager() - onetime init @@ -337,8 +333,6 @@ void DestroyThread(Thread *th); DWORD GetRuntimeId(); -EXTERN_C Thread* WINAPI CreateThreadBlockThrow(); - #define CREATETHREAD_IF_NULL_FAILFAST(__thread, __msg) \ { \ HRESULT __ctinffhr; \