Beispiel #1
0
        public void RemoveThread(KThread Thread)
        {
            PrintDbgThreadInfo(Thread, "exited.");

            lock (SchedLock)
            {
                if (AllThreads.TryRemove(Thread, out SchedulerThread SchedThread))
                {
                    WaitingToRun.Remove(SchedThread);

                    SchedThread.Dispose();
                }

                int ActualCore = Thread.ActualCore;

                SchedulerThread NewThread = WaitingToRun.Pop(ActualCore);

                if (NewThread == null)
                {
                    Log.PrintDebug(LogClass.KernelScheduler, $"Nothing to run on core {ActualCore}!");

                    CoreThreads[ActualCore] = null;

                    return;
                }

                NewThread.Thread.ActualCore = ActualCore;

                RunThread(NewThread);
            }
        }
        public void RemoveThread(KThread Thread)
        {
            PrintDbgThreadInfo(Thread, "exited.");

            lock (SchedLock)
            {
                if (AllThreads.TryRemove(Thread, out SchedulerThread SchedThread))
                {
                    WaitingToRun[Thread.ProcessorId].Remove(SchedThread);

                    SchedThread.Dispose();
                }

                SchedulerThread NewThread = WaitingToRun[Thread.ProcessorId].Pop();

                if (NewThread == null)
                {
                    Log.PrintDebug(LogClass.KernelScheduler, $"Nothing to run on core {Thread.ProcessorId}!");

                    ActiveProcessors.Remove(Thread.ProcessorId);

                    return;
                }

                RunThread(NewThread);
            }
        }
Beispiel #3
0
 protected virtual void Dispose(bool Disposing)
 {
     if (Disposing)
     {
         foreach (SchedulerThread SchedThread in AllThreads.Values)
         {
             SchedThread.Dispose();
         }
     }
 }
Beispiel #4
0
        protected virtual void Dispose(bool Disposing)
        {
            if (Disposing)
            {
                foreach (Queue <SchedulerThread> SchedThreads in WaitingThreads)
                {
                    foreach (SchedulerThread SchedThread in SchedThreads)
                    {
                        SchedThread.Dispose();
                    }

                    SchedThreads.Clear();
                }
            }
        }