Merge branch 'master' into feature/savestates-2
This commit is contained in:
commit
9cd669db84
14 changed files with 130 additions and 106 deletions
|
@ -104,11 +104,13 @@ void Thread::Stop() {
|
|||
|
||||
void ThreadManager::SwitchContext(Thread* new_thread) {
|
||||
Thread* previous_thread = GetCurrentThread();
|
||||
std::shared_ptr<Process> previous_process = nullptr;
|
||||
|
||||
Core::Timing& timing = kernel.timing;
|
||||
|
||||
// Save context for previous thread
|
||||
if (previous_thread) {
|
||||
previous_process = previous_thread->owner_process;
|
||||
previous_thread->last_running_ticks = timing.GetGlobalTicks();
|
||||
cpu->SaveContext(previous_thread->context);
|
||||
|
||||
|
@ -128,8 +130,6 @@ void ThreadManager::SwitchContext(Thread* new_thread) {
|
|||
// Cancel any outstanding wakeup events for this thread
|
||||
timing.UnscheduleEvent(ThreadWakeupEventType, new_thread->thread_id);
|
||||
|
||||
auto previous_process = kernel.GetCurrentProcess();
|
||||
|
||||
current_thread = SharedFrom(new_thread);
|
||||
|
||||
ready_queue.remove(new_thread->current_priority, new_thread);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue