Skip to content

Commit

Permalink
Delete dead code (dotnet#108265)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored and sirntar committed Sep 30, 2024
1 parent 5b2a802 commit fdf3940
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 46 deletions.
4 changes: 0 additions & 4 deletions src/coreclr/inc/corexcep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
38 changes: 2 additions & 36 deletions src/coreclr/vm/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>
// @TODO cwb: for a typical shutdown, only background threads are still around.
// Should we interrupt them? What about the non-typical shutdown?</TODO>

int Thread::IncExternalCount()
{
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -337,8 +333,6 @@ void DestroyThread(Thread *th);

DWORD GetRuntimeId();

EXTERN_C Thread* WINAPI CreateThreadBlockThrow();

#define CREATETHREAD_IF_NULL_FAILFAST(__thread, __msg) \
{ \
HRESULT __ctinffhr; \
Expand Down

0 comments on commit fdf3940

Please sign in to comment.