Kernel: replace usage of Core::System::GetInstance().PrepareReschedule() with callback

This commit is contained in:
Weiyi Wang 2019-02-01 12:19:20 -05:00
parent eb050b8403
commit 20f47583f6
9 changed files with 25 additions and 13 deletions

View file

@ -24,7 +24,7 @@ void ReleaseThreadMutexes(Thread* thread) {
thread->held_mutexes.clear();
}
Mutex::Mutex(KernelSystem& kernel) : WaitObject(kernel) {}
Mutex::Mutex(KernelSystem& kernel) : WaitObject(kernel), kernel(kernel) {}
Mutex::~Mutex() {}
SharedPtr<Mutex> KernelSystem::CreateMutex(bool initial_locked, std::string name) {
@ -54,7 +54,7 @@ void Mutex::Acquire(Thread* thread) {
thread->held_mutexes.insert(this);
holding_thread = thread;
thread->UpdatePriority();
Core::System::GetInstance().PrepareReschedule();
kernel.PrepareReschedule();
}
lock_count++;
@ -87,7 +87,7 @@ ResultCode Mutex::Release(Thread* thread) {
holding_thread->UpdatePriority();
holding_thread = nullptr;
WakeupAllWaitingThreads();
Core::System::GetInstance().PrepareReschedule();
kernel.PrepareReschedule();
}
return RESULT_SUCCESS;