diff options
Diffstat (limited to 'src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.Unix.cs')
-rw-r--r-- | src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.Unix.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.Unix.cs b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.Unix.cs index 7b9d380e7..bc3a042eb 100644 --- a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.Unix.cs +++ b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.Unix.cs @@ -144,6 +144,14 @@ namespace Internal.Runtime.Augments return IntPtr.Zero; } + private void InitializeComOnNewThread() + { + } + + internal static void InitializeCom() + { + } + public void Interrupt() => WaitSubsystem.Interrupt(this); internal static void UninterruptibleSleep0() => WaitSubsystem.UninterruptibleSleep0(); private static void SleepInternal(int millisecondsTimeout) => WaitSubsystem.Sleep(millisecondsTimeout); @@ -159,5 +167,17 @@ namespace Internal.Runtime.Augments { throw new PlatformNotSupportedException(); } + + private static int ComputeCurrentProcessorId() + { + int processorId = Interop.Sys.SchedGetCpu(); + + // sched_getcpu doesn't exist on all platforms. On those it doesn't exist on, the shim + // returns -1. As a fallback in that case and to spread the threads across the buckets + // by default, we use the current managed thread ID as a proxy. + if (processorId < 0) processorId = Environment.CurrentManagedThreadId; + + return processorId; + } } } |