コード例 #1
0
        public void UpdatePriority()
        {
            int OldPriority = ActualPriority;

            int CurrPriority = WantedPriority;

            lock (Process.ThreadSyncLock)
            {
                foreach (KThread Thread in MutexWaiters)
                {
                    if (CurrPriority > Thread.WantedPriority)
                    {
                        CurrPriority = Thread.WantedPriority;
                    }
                }
            }

            if (CurrPriority != OldPriority)
            {
                ActualPriority = CurrPriority;

                Process.Scheduler.Resort(this);

                MutexOwner?.UpdatePriority();
            }
        }
コード例 #2
0
        public void UpdatePriority()
        {
            bool PriorityChanged;

            lock (Process.ThreadSyncLock)
            {
                int OldPriority = ActualPriority;

                int CurrPriority = WantedPriority;

                foreach (KThread Thread in MutexWaiters)
                {
                    int WantedPriority = Thread.WantedPriority;

                    if (CurrPriority > WantedPriority)
                    {
                        CurrPriority = WantedPriority;
                    }
                }

                PriorityChanged = CurrPriority != OldPriority;

                ActualPriority = CurrPriority;
            }

            if (PriorityChanged)
            {
                Process.Scheduler.Resort(this);

                MutexOwner?.UpdatePriority();
            }
        }
コード例 #3
0
        public void UpdatePriority()
        {
            int OldPriority = ActualPriority;

            int CurrPriority = WantedPriority;

            if (NextMutexThread != null && CurrPriority > NextMutexThread.WantedPriority)
            {
                CurrPriority = NextMutexThread.WantedPriority;
            }

            if (CurrPriority != OldPriority)
            {
                ActualPriority = CurrPriority;

                UpdateWaitList();

                MutexOwner?.UpdatePriority();
            }
        }