diff options
| author | bunnei <bunneidev@gmail.com> | 2021-01-29 23:06:40 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-29 23:06:40 -0800 |
| commit | a4526c4e1acb50808bbe205952101142288e1c60 (patch) | |
| tree | 7109edf89606c43352da9de40d0e3a920a08b659 /src/core/hle/kernel/global_scheduler_context.h | |
| parent | 5861bacafd76b76bc196e9522e0315fb243635f8 (diff) | |
| parent | 543e2125541aa3c3399dd471cd170153ce67c369 (diff) | |
Merge pull request #5779 from bunnei/kthread-rewrite
Rewrite KThread to be more accurate
Diffstat (limited to 'src/core/hle/kernel/global_scheduler_context.h')
| -rw-r--r-- | src/core/hle/kernel/global_scheduler_context.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/core/hle/kernel/global_scheduler_context.h b/src/core/hle/kernel/global_scheduler_context.h index 5c7b89290..11592843e 100644 --- a/src/core/hle/kernel/global_scheduler_context.h +++ b/src/core/hle/kernel/global_scheduler_context.h @@ -12,7 +12,8 @@ #include "core/hardware_properties.h" #include "core/hle/kernel/k_priority_queue.h" #include "core/hle/kernel/k_scheduler_lock.h" -#include "core/hle/kernel/thread.h" +#include "core/hle/kernel/k_thread.h" +#include "core/hle/kernel/svc_types.h" namespace Kernel { @@ -20,8 +21,12 @@ class KernelCore; class SchedulerLock; using KSchedulerPriorityQueue = - KPriorityQueue<Thread, Core::Hardware::NUM_CPU_CORES, THREADPRIO_LOWEST, THREADPRIO_HIGHEST>; -constexpr s32 HighestCoreMigrationAllowedPriority = 2; + KPriorityQueue<KThread, Core::Hardware::NUM_CPU_CORES, Svc::LowestThreadPriority, + Svc::HighestThreadPriority>; + +static constexpr s32 HighestCoreMigrationAllowedPriority = 2; +static_assert(Svc::LowestThreadPriority >= HighestCoreMigrationAllowedPriority); +static_assert(Svc::HighestThreadPriority <= HighestCoreMigrationAllowedPriority); class GlobalSchedulerContext final { friend class KScheduler; @@ -33,13 +38,13 @@ public: ~GlobalSchedulerContext(); /// Adds a new thread to the scheduler - void AddThread(std::shared_ptr<Thread> thread); + void AddThread(std::shared_ptr<KThread> thread); /// Removes a thread from the scheduler - void RemoveThread(std::shared_ptr<Thread> thread); + void RemoveThread(std::shared_ptr<KThread> thread); /// Returns a list of all threads managed by the scheduler - [[nodiscard]] const std::vector<std::shared_ptr<Thread>>& GetThreadList() const { + [[nodiscard]] const std::vector<std::shared_ptr<KThread>>& GetThreadList() const { return thread_list; } @@ -74,7 +79,7 @@ private: LockType scheduler_lock; /// Lists all thread ids that aren't deleted/etc. - std::vector<std::shared_ptr<Thread>> thread_list; + std::vector<std::shared_ptr<KThread>> thread_list; Common::SpinLock global_list_guard{}; }; |
