Skip to content

Commit 4c01386

Browse files
authored
Remove get_ManagedThreadId FCall (#91232)
1 parent 00838f3 commit 4c01386

File tree

5 files changed

+2
-22
lines changed

5 files changed

+2
-22
lines changed

src/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ public sealed partial class Thread
6060

6161
private Thread() { }
6262

63-
public extern int ManagedThreadId
63+
public int ManagedThreadId
6464
{
6565
[Intrinsic]
66-
[MethodImpl(MethodImplOptions.InternalCall)]
67-
get;
66+
get => _managedThreadId;
6867
}
6968

7069
/// <summary>Returns handle for interop with EE. The handle is guaranteed to be non-null.</summary>

src/coreclr/vm/comsynchronizable.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,6 @@ FCIMPL1(void, ThreadNative::Sleep, INT32 iTime)
475475
}
476476
FCIMPLEND
477477

478-
FCIMPL1(INT32, ThreadNative::GetManagedThreadId, ThreadBaseObject* th) {
479-
FCALL_CONTRACT;
480-
481-
FC_GC_POLL_NOT_NEEDED();
482-
if (th == NULL)
483-
FCThrow(kNullReferenceException);
484-
485-
return th->GetManagedThreadId();
486-
}
487-
FCIMPLEND
488-
489478
NOINLINE static Object* GetCurrentThreadHelper()
490479
{
491480
FCALL_CONTRACT;

src/coreclr/vm/comsynchronizable.h

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ friend class ThreadBaseObject;
6969
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
7070

7171

72-
static FCDECL1(INT32, GetManagedThreadId, ThreadBaseObject* th);
7372
static FCDECL0(INT32, GetOptimalMaxSpinWaitsPerSpinIteration);
7473
static FCDECL1(void, SpinWait, int iterations);
7574
static FCDECL0(Object*, GetCurrentThread);

src/coreclr/vm/ecalllist.h

-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ FCFuncStart(gThreadFuncs)
371371
FCFuncElement("Initialize", ThreadNative::Initialize)
372372
FCFuncElement("SpinWaitInternal", ThreadNative::SpinWait)
373373
FCFuncElement("GetCurrentThreadNative", ThreadNative::GetCurrentThread)
374-
FCFuncElement("get_ManagedThreadId", ThreadNative::GetManagedThreadId)
375374
FCFuncElement("InternalFinalize", ThreadNative::Finalize)
376375
FCFuncElement("get_IsAlive", ThreadNative::IsAlive)
377376
FCFuncElement("IsBackgroundNative", ThreadNative::IsBackground)

src/coreclr/vm/object.h

-6
Original file line numberDiff line numberDiff line change
@@ -1343,12 +1343,6 @@ class ThreadBaseObject : public Object
13431343
void SetInternal(Thread *it);
13441344
void ClearInternal();
13451345

1346-
INT32 GetManagedThreadId()
1347-
{
1348-
LIMITED_METHOD_CONTRACT;
1349-
return m_ManagedThreadId;
1350-
}
1351-
13521346
void SetManagedThreadId(INT32 id)
13531347
{
13541348
LIMITED_METHOD_CONTRACT;

0 commit comments

Comments
 (0)