Skip to content

Commit

Permalink
Change Environment.CurrentManagedThreadId back to FCall (dotnet#41360)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas committed Aug 26, 2020
1 parent bf90c7a commit 5f32450
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ namespace System
{
public static partial class Environment
{
public static int CurrentManagedThreadId => Thread.CurrentThread.ManagedThreadId;
public static extern int CurrentManagedThreadId
{
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}

// Terminates this process with the given exit code.
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/vm/ecalllist.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ FCFuncStart(gDateTimeFuncs)
FCFuncEnd()

FCFuncStart(gEnvironmentFuncs)
FCFuncElement("get_CurrentManagedThreadId", JIT_GetCurrentManagedThreadId)
FCFuncElement("get_TickCount", SystemNative::GetTickCount)
FCFuncElement("get_TickCount64", SystemNative::GetTickCount64)
QCFuncElement("_Exit", SystemNative::Exit)
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4932,7 +4932,7 @@ HCIMPLEND



HCIMPL0(INT32, JIT_GetCurrentManagedThreadId)
FCIMPL0(INT32, JIT_GetCurrentManagedThreadId)
{
FCALL_CONTRACT;

Expand All @@ -4941,7 +4941,7 @@ HCIMPL0(INT32, JIT_GetCurrentManagedThreadId)
Thread * pThread = GetThread();
return pThread->GetThreadId();
}
HCIMPLEND
FCIMPLEND


/*********************************************************************/
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/src/vm/jitinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,8 @@ EXTERN_C FCDECL2(void*, JIT_GetSharedGCStaticBase_Helper, DomainLocalModule *pLo

EXTERN_C void DoJITFailFast ();
EXTERN_C FCDECL0(void, JIT_FailFast);
extern FCDECL3(void, JIT_ThrowAccessException, RuntimeExceptionKind, CORINFO_METHOD_HANDLE caller, void * callee);

FCDECL1(void*, JIT_SafeReturnableByref, void* byref);
FCDECL0(int, JIT_GetCurrentManagedThreadId);

#if !defined(FEATURE_USE_ASM_GC_WRITE_BARRIERS) && defined(FEATURE_COUNT_GC_WRITE_BARRIERS)
// Extra argument for the classification of the checked barriers.
Expand Down

0 comments on commit 5f32450

Please sign in to comment.