diff options
author | Lioncash <mathew1800@gmail.com> | 2018-10-15 09:25:11 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-10-15 14:15:56 -0400 |
commit | 5484742fdaf036db03ac7b8c746df5004f74efad (patch) | |
tree | 71f2f25319773fa718ade73b59fccccfbceedb12 /src/core/core.cpp | |
parent | 59f872a8e06328da18c7fb1948aec76355afb567 (diff) |
core_cpu: Make Cpu scheduler instances unique_ptrs instead of shared_ptrs
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r-- | src/core/core.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 52433731a9..3c57a62ec9 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -355,12 +355,15 @@ std::size_t System::CurrentCoreIndex() { } Kernel::Scheduler& System::CurrentScheduler() { - return *CurrentCpuCore().Scheduler(); + return CurrentCpuCore().Scheduler(); } -const std::shared_ptr<Kernel::Scheduler>& System::Scheduler(std::size_t core_index) { - ASSERT(core_index < NUM_CPU_CORES); - return impl->cpu_cores[core_index]->Scheduler(); +Kernel::Scheduler& System::Scheduler(std::size_t core_index) { + return CpuCore(core_index).Scheduler(); +} + +const Kernel::Scheduler& System::Scheduler(std::size_t core_index) const { + return CpuCore(core_index).Scheduler(); } Kernel::Process* System::CurrentProcess() { @@ -381,6 +384,11 @@ Cpu& System::CpuCore(std::size_t core_index) { return *impl->cpu_cores[core_index]; } +const Cpu& System::CpuCore(std::size_t core_index) const { + ASSERT(core_index < NUM_CPU_CORES); + return *impl->cpu_cores[core_index]; +} + ExclusiveMonitor& System::Monitor() { return *impl->cpu_exclusive_monitor; } |