Kernel: Corrections to ModifyByWaitingCountAndSignalToAddressIfEqual

master
Fernando Sahmkow 2019-10-07 19:09:57 +07:00 committed by FernandoS27
parent 44e09e5f21
commit 7176857177
1 changed files with 13 additions and 5 deletions

@ -91,12 +91,20 @@ ResultCode AddressArbiter::ModifyByWaitingCountAndSignalToAddressIfEqual(VAddr a
// Determine the modified value depending on the waiting count. // Determine the modified value depending on the waiting count.
s32 updated_value; s32 updated_value;
if (waiting_threads.empty()) { if (num_to_wake <= 0) {
updated_value = value + 1; if (waiting_threads.empty()) {
} else if (num_to_wake <= 0 || waiting_threads.size() <= static_cast<u32>(num_to_wake)) { updated_value = value + 1;
updated_value = value - 1; } else {
updated_value = value - 1;
}
} else { } else {
updated_value = value; if (waiting_threads.empty()) {
updated_value = value + 1;
} else if (waiting_threads.size() <= static_cast<u32>(num_to_wake)) {
updated_value = value - 1;
} else {
updated_value = value;
}
} }
if (static_cast<s32>(Memory::Read32(address)) != value) { if (static_cast<s32>(Memory::Read32(address)) != value) {