mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
Kernel: Correct SignalProcessWideKey
When the target is 0, all threads must be processed.
This commit is contained in:
parent
2d16507f9f
commit
2ab41ceff4
1 changed files with 2 additions and 6 deletions
|
@ -1649,16 +1649,12 @@ static ResultCode SignalProcessWideKey(Core::System& system, VAddr condition_var
|
||||||
std::vector<SharedPtr<Thread>> waiting_threads =
|
std::vector<SharedPtr<Thread>> waiting_threads =
|
||||||
current_process->GetConditionVariableThreads(condition_variable_addr);
|
current_process->GetConditionVariableThreads(condition_variable_addr);
|
||||||
|
|
||||||
// Only process up to 'target' threads, unless 'target' is -1, in which case process
|
// Only process up to 'target' threads, unless 'target' is less equal 0, in which case process
|
||||||
// them all.
|
// them all.
|
||||||
std::size_t last = waiting_threads.size();
|
std::size_t last = waiting_threads.size();
|
||||||
if (target != -1)
|
if (target > 0)
|
||||||
last = std::min(waiting_threads.size(), static_cast<std::size_t>(target));
|
last = std::min(waiting_threads.size(), static_cast<std::size_t>(target));
|
||||||
|
|
||||||
// If there are no threads waiting on this condition variable, just exit
|
|
||||||
if (last == 0)
|
|
||||||
return RESULT_SUCCESS;
|
|
||||||
|
|
||||||
for (std::size_t index = 0; index < last; ++index) {
|
for (std::size_t index = 0; index < last; ++index) {
|
||||||
auto& thread = waiting_threads[index];
|
auto& thread = waiting_threads[index];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue