diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-03-20 01:57:31 +0100 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-03-20 03:43:13 +0100 |
commit | 9c7319a4d423a20c45cd8d7898c2f73659526d33 (patch) | |
tree | 04113e5a14cd55e88b2866c9d2f33e6fb59858dd /src/core/hle/kernel/svc.cpp | |
parent | Add CondVar Thread State. (diff) | |
download | yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.tar yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.tar.gz yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.tar.bz2 yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.tar.lz yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.tar.xz yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.tar.zst yuzu-9c7319a4d423a20c45cd8d7898c2f73659526d33.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 37608e27a..d40a2226b 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1405,6 +1405,9 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target ASSERT(thread->GetCondVarWaitAddress() == condition_variable_addr); + // liberate Cond Var Thread. + thread->SetCondVarWaitAddress(0); + std::size_t current_core = Core::System::GetInstance().CurrentCoreIndex(); auto& monitor = Core::System::GetInstance().Monitor(); @@ -1423,10 +1426,9 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target } } while (!monitor.ExclusiveWrite32(current_core, thread->GetMutexWaitAddress(), thread->GetWaitHandle())); - if (mutex_val == 0) { // We were able to acquire the mutex, resume this thread. - ASSERT(thread->GetStatus() == ThreadStatus::WaitMutex); + ASSERT(thread->GetStatus() == ThreadStatus::WaitCondVar); thread->ResumeFromWait(); auto* const lock_owner = thread->GetLockOwner(); @@ -1436,8 +1438,8 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target thread->SetLockOwner(nullptr); thread->SetMutexWaitAddress(0); - thread->SetCondVarWaitAddress(0); thread->SetWaitHandle(0); + Core::System::GetInstance().CpuCore(thread->GetProcessorID()).PrepareReschedule(); } else { // Atomically signal that the mutex now has a waiting thread. do { @@ -1458,10 +1460,9 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target ASSERT(owner); ASSERT(thread->GetStatus() == ThreadStatus::WaitCondVar); thread->InvalidateWakeupCallback(); + thread->SetStatus(ThreadStatus::WaitMutex); owner->AddMutexWaiter(thread); - - Core::System::GetInstance().CpuCore(thread->GetProcessorID()).PrepareReschedule(); } } |