public void ContextSwitch() { ContextSwitchNeeded = false; LastContextSwitchTime = PerformanceCounter.ElapsedMilliseconds; if (CurrentThread != null) { CoreManager.Reset(CurrentThread.Context.Work); } CurrentThread = SelectedThread; if (CurrentThread != null) { long CurrentTime = PerformanceCounter.ElapsedMilliseconds; CurrentThread.TotalTimeRunning += CurrentTime - CurrentThread.LastScheduledTime; CurrentThread.LastScheduledTime = CurrentTime; CurrentThread.ClearExclusive(); CoreManager.Set(CurrentThread.Context.Work); CurrentThread.Context.Execute(); } }
public void ContextSwitch() { ContextSwitchNeeded = false; if (CurrentThread != null) { CoreManager.GetThread(CurrentThread.Thread.Work).Pause(); } CurrentThread = SelectedThread; if (CurrentThread != null) { CurrentThread.ClearExclusive(); CoreManager.GetThread(CurrentThread.Thread.Work).Unpause(); CurrentThread.Thread.Execute(); } }