summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-11-16 13:55:21 -0400
committerGravatar FernandoS272019-11-21 10:46:55 -0400
commit2ab41ceff469cfa9b13f6357ce558b3388b0fe30 (patch)
treebc4a6798ecab65f30ec1ebd949c7a789331f4572 /src/core/hle/kernel/svc.cpp
parentKernel: Correct behavior of Condition Variables to be more similar to real ha... (diff)
downloadyuzu-2ab41ceff469cfa9b13f6357ce558b3388b0fe30.tar.gz
yuzu-2ab41ceff469cfa9b13f6357ce558b3388b0fe30.tar.xz
yuzu-2ab41ceff469cfa9b13f6357ce558b3388b0fe30.zip
Kernel: Correct SignalProcessWideKey
When the target is 0, all threads must be processed.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index c27529f4d..4fdb6d429 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1649,16 +1649,12 @@ static ResultCode SignalProcessWideKey(Core::System& system, VAddr condition_var
1649 std::vector<SharedPtr<Thread>> waiting_threads = 1649 std::vector<SharedPtr<Thread>> waiting_threads =
1650 current_process->GetConditionVariableThreads(condition_variable_addr); 1650 current_process->GetConditionVariableThreads(condition_variable_addr);
1651 1651
1652 // Only process up to 'target' threads, unless 'target' is -1, in which case process 1652 // Only process up to 'target' threads, unless 'target' is less equal 0, in which case process
1653 // them all. 1653 // them all.
1654 std::size_t last = waiting_threads.size(); 1654 std::size_t last = waiting_threads.size();
1655 if (target != -1) 1655 if (target > 0)
1656 last = std::min(waiting_threads.size(), static_cast<std::size_t>(target)); 1656 last = std::min(waiting_threads.size(), static_cast<std::size_t>(target));
1657 1657
1658 // If there are no threads waiting on this condition variable, just exit
1659 if (last == 0)
1660 return RESULT_SUCCESS;
1661
1662 for (std::size_t index = 0; index < last; ++index) { 1658 for (std::size_t index = 0; index < last; ++index) {
1663 auto& thread = waiting_threads[index]; 1659 auto& thread = waiting_threads[index];
1664 1660