summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_condition_variable.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-02-23 21:49:42 +0100
committerLiam <byteslice@airmail.cc>2023-03-01 16:42:45 +0100
commitc4ba088a5df13ff4b4d8853216231d690f2c79c0 (patch)
tree342ac4bde84bf135918bf425b5271a3599d572db /src/core/hle/kernel/k_condition_variable.cpp
parentkernel: simplify AddressSpaceInfo, update values (diff)
downloadyuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.tar
yuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.tar.gz
yuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.tar.bz2
yuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.tar.lz
yuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.tar.xz
yuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.tar.zst
yuzu-c4ba088a5df13ff4b4d8853216231d690f2c79c0.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_condition_variable.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp
index c6a088942..8dae78397 100644
--- a/src/core/hle/kernel/k_condition_variable.cpp
+++ b/src/core/hle/kernel/k_condition_variable.cpp
@@ -111,15 +111,15 @@ Result KConditionVariable::SignalToAddress(VAddr addr) {
KScopedSchedulerLock sl(kernel);
// Remove waiter thread.
- s32 num_waiters{};
+ bool has_waiters{};
KThread* const next_owner_thread =
- owner_thread->RemoveWaiterByKey(std::addressof(num_waiters), addr);
+ owner_thread->RemoveWaiterByKey(std::addressof(has_waiters), addr);
// Determine the next tag.
u32 next_value{};
if (next_owner_thread != nullptr) {
next_value = next_owner_thread->GetAddressKeyValue();
- if (num_waiters > 1) {
+ if (has_waiters) {
next_value |= Svc::HandleWaitMask;
}
}
@@ -247,9 +247,11 @@ void KConditionVariable::Signal(u64 cv_key, s32 count) {
(it->GetConditionVariableKey() == cv_key)) {
KThread* target_thread = std::addressof(*it);
- this->SignalImpl(target_thread);
it = thread_tree.erase(it);
target_thread->ClearConditionVariable();
+
+ this->SignalImpl(target_thread);
+
++num_waiters;
}
@@ -279,16 +281,16 @@ Result KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout) {
// Update the value and process for the next owner.
{
// Remove waiter thread.
- s32 num_waiters{};
+ bool has_waiters{};
KThread* next_owner_thread =
- cur_thread->RemoveWaiterByKey(std::addressof(num_waiters), addr);
+ cur_thread->RemoveWaiterByKey(std::addressof(has_waiters), addr);
// Update for the next owner thread.
u32 next_value{};
if (next_owner_thread != nullptr) {
// Get the next tag value.
next_value = next_owner_thread->GetAddressKeyValue();
- if (num_waiters > 1) {
+ if (has_waiters) {
next_value |= Svc::HandleWaitMask;
}