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); } }
protected virtual void Dispose(bool Disposing) { if (Disposing) { foreach (SchedulerThread SchedThread in AllThreads.Values) { SchedThread.Dispose(); } } }
protected virtual void Dispose(bool Disposing) { if (Disposing) { foreach (Queue <SchedulerThread> SchedThreads in WaitingThreads) { foreach (SchedulerThread SchedThread in SchedThreads) { SchedThread.Dispose(); } SchedThreads.Clear(); } } }