mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
kern: update KConditionVariable to support new has_waiter_flag rules
This commit is contained in:
parent
8e1a46b951
commit
f058d04933
1 changed files with 13 additions and 0 deletions
|
@ -194,6 +194,12 @@ namespace ams::kern {
|
||||||
target_thread->ClearConditionVariable();
|
target_thread->ClearConditionVariable();
|
||||||
++num_waiters;
|
++num_waiters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we have no waiters, clear the has waiter flag. */
|
||||||
|
if (it == this->tree.end() || it->GetConditionVariableKey() != cv_key) {
|
||||||
|
const u32 has_waiter_flag = 0;
|
||||||
|
WriteToUser(cv_key, std::addressof(has_waiter_flag));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close threads in the array. */
|
/* Close threads in the array. */
|
||||||
|
@ -244,6 +250,13 @@ namespace ams::kern {
|
||||||
next_owner_thread->Wakeup();
|
next_owner_thread->Wakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write to the cv key. */
|
||||||
|
{
|
||||||
|
const u32 has_waiter_flag = 1;
|
||||||
|
WriteToUser(key, std::addressof(has_waiter_flag));
|
||||||
|
cpu::DataMemoryBarrier();
|
||||||
|
}
|
||||||
|
|
||||||
/* Write the value to userspace. */
|
/* Write the value to userspace. */
|
||||||
if (!WriteToUser(addr, std::addressof(next_value))) {
|
if (!WriteToUser(addr, std::addressof(next_value))) {
|
||||||
slp.CancelSleep();
|
slp.CancelSleep();
|
||||||
|
|
Loading…
Reference in a new issue