Kernel: Initial implementation of thread preemption.

This commit is contained in:
Fernando Sahmkow 2019-09-10 11:04:40 -04:00 committed by FernandoS27
parent 103f3a2fe5
commit b49c0dab87
3 changed files with 30 additions and 0 deletions

View file

@ -133,6 +133,8 @@ public:
*/
bool YieldThreadAndWaitForLoadBalancing(Thread* thread);
void PreemptThreads();
u32 CpuCoresCount() const {
return NUM_CPU_CORES;
}
@ -153,6 +155,8 @@ private:
std::array<Common::MultiLevelQueue<Thread*, THREADPRIO_COUNT>, NUM_CPU_CORES> suggested_queue;
std::atomic<bool> reselection_pending;
std::array<u64, NUM_CPU_CORES> preemption_priorities = {59, 59, 59, 62};
/// Lists all thread ids that aren't deleted/etc.
std::vector<SharedPtr<Thread>> thread_list;
Core::System& system;