|
|
@ -91,13 +91,21 @@ 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 (num_to_wake <= 0) {
|
|
|
|
if (waiting_threads.empty()) {
|
|
|
|
if (waiting_threads.empty()) {
|
|
|
|
updated_value = value + 1;
|
|
|
|
updated_value = value + 1;
|
|
|
|
} else if (num_to_wake <= 0 || waiting_threads.size() <= static_cast<u32>(num_to_wake)) {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
updated_value = value - 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (waiting_threads.empty()) {
|
|
|
|
|
|
|
|
updated_value = value + 1;
|
|
|
|
|
|
|
|
} else if (waiting_threads.size() <= static_cast<u32>(num_to_wake)) {
|
|
|
|
updated_value = value - 1;
|
|
|
|
updated_value = value - 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
updated_value = value;
|
|
|
|
updated_value = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (static_cast<s32>(Memory::Read32(address)) != value) {
|
|
|
|
if (static_cast<s32>(Memory::Read32(address)) != value) {
|
|
|
|
return ERR_INVALID_STATE;
|
|
|
|
return ERR_INVALID_STATE;
|
|
|
|