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 c52f37f259
commit 2d16507f9f
5 changed files with 74 additions and 15 deletions

View file

@ -232,6 +232,15 @@ public:
return thread_list;
}
/// Insert a thread into the condition variable wait container
void InsertConditionVariableThread(SharedPtr<Thread> thread);
/// Remove a thread from the condition variable wait container
void RemoveConditionVariableThread(SharedPtr<Thread> thread);
/// Obtain all condition variable threads waiting for some address
std::vector<SharedPtr<Thread>> GetConditionVariableThreads(VAddr cond_var_addr);
/// Registers a thread as being created under this process,
/// adding it to this process' thread list.
void RegisterThread(const Thread* thread);
@ -375,6 +384,9 @@ private:
/// List of threads that are running with this process as their owner.
std::list<const Thread*> thread_list;
/// List of threads waiting for a condition variable
std::list<SharedPtr<Thread>> cond_var_threads;
/// System context
Core::System& system;