Пример #1
0
        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();
            }
        }
Пример #2
0
        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();
            }
        }