Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2018-08-01 01:07:18 +0300
committerJan Kotas <jkotas@microsoft.com>2018-08-01 01:07:18 +0300
commita57befcc80b1c257ec5b6e41c5b690e6d740dcd3 (patch)
treef81bf08878837785eaf513c5eae50fe8370fc39f /src
parentb7ea3897c635e746573a6ff50bf2f2a54be16126 (diff)
Implement RuntimeThread.CurrentOSThreadId. (#6161)
Diffstat (limited to 'src')
-rw-r--r--src/Native/Runtime/thread.cpp6
-rw-r--r--src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs8
-rw-r--r--src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs4
3 files changed, 18 insertions, 0 deletions
diff --git a/src/Native/Runtime/thread.cpp b/src/Native/Runtime/thread.cpp
index cb6c3990c..aaefff971 100644
--- a/src/Native/Runtime/thread.cpp
+++ b/src/Native/Runtime/thread.cpp
@@ -1363,6 +1363,12 @@ COOP_PINVOKE_HELPER(UInt8*, RhCurrentNativeThreadId, ())
}
#endif // !PROJECTN
+// This function is used to get the OS thread identifier for the current thread.
+COOP_PINVOKE_HELPER(UInt64, RhCurrentOSThreadId, ())
+{
+ return PalGetCurrentThreadIdForLogging();
+}
+
// Standard calling convention variant and actual implementation for RhpReversePInvokeAttachOrTrapThread
EXTERN_C NOINLINE void FASTCALL RhpReversePInvokeAttachOrTrapThread2(ReversePInvokeFrame * pFrame)
{
diff --git a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs
index 3dfb5b07c..4935750d5 100644
--- a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs
+++ b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs
@@ -80,6 +80,14 @@ namespace Internal.Runtime.Augments
}
}
+ internal static ulong CurrentOSThreadId
+ {
+ get
+ {
+ return RuntimeImports.RhCurrentOSThreadId();
+ }
+ }
+
// Slow path executed once per thread
private static RuntimeThread InitializeExistingThread(bool threadPoolThread)
{
diff --git a/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
index acc2fd324..add147252 100644
--- a/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
+++ b/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
@@ -573,6 +573,10 @@ namespace System.Runtime
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [RuntimeImport(RuntimeLibrary, "RhCurrentOSThreadId")]
+ internal static unsafe extern ulong RhCurrentOSThreadId();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
[RuntimeImport("*", "RhGetCurrentThunkContext")]
internal static extern IntPtr GetCurrentInteropThunkContext();