Ejemplo n.º 1
0
            private void InitializeProcessThreads()
            {
                if (PlatformDetails.RunningOnMacOsx)
                {
                    return;
                }

                CurrentUnmanagedThreadId = NativeMemory.GetCurrentUnmanagedThreadId.Invoke();
                CurrentProcess           = Process.GetCurrentProcess();

                if (PlatformDetails.RunningOnPosix == false)
                {
                    foreach (ProcessThread pt in CurrentProcess.Threads)
                    {
                        if (pt.Id == (uint)CurrentUnmanagedThreadId)
                        {
                            CurrentProcessThread = pt;
                            break;
                        }
                    }

                    if (CurrentProcessThread == null)
                    {
                        throw new InvalidOperationException("Unable to get the current process thread: " + CurrentUnmanagedThreadId + ", this should not be possible");
                    }
                }

                AffinityHelper.ResetThreadAffinity(this);
            }
Ejemplo n.º 2
0
            private bool ResetThreadAffinity()
            {
                NumberOfCoresToReduce = 0;
                ThreadMask            = null;

                return(AffinityHelper.ResetThreadAffinity(this));
            }