Kernel: Correct behavior of Condition Variables to be more similar to real hardware.

This commit ensures cond var threads act exactly as they do in the real
console. The original implementation uses an RBTree and the behavior of
cond var threads is that at the same priority level they act like a
FIFO.
This commit is contained in:
Fernando Sahmkow 2019-11-14 20:13:18 -04:00 committed by FernandoS27
parent 424a78bd3f
commit b021fa33b9
5 changed files with 74 additions and 15 deletions

View file

@ -306,8 +306,16 @@ void Thread::UpdatePriority() {
return;
}
if (GetStatus() == ThreadStatus::WaitCondVar) {
owner_process->RemoveConditionVariableThread(this);
}
SetCurrentPriority(new_priority);
if (GetStatus() == ThreadStatus::WaitCondVar) {
owner_process->InsertConditionVariableThread(this);
}
if (!lock_owner) {
return;
}