Kernel: replace usage of Core::System::GetInstance().PrepareReschedule() with callback

This commit is contained in:
Weiyi Wang 2019-02-01 12:19:20 -05:00
parent eb050b8403
commit 20f47583f6
9 changed files with 25 additions and 13 deletions

View file

@ -6,6 +6,7 @@
#include <array>
#include <atomic>
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
@ -82,7 +83,8 @@ using SharedPtr = boost::intrusive_ptr<T>;
class KernelSystem {
public:
explicit KernelSystem(Memory::MemorySystem& memory, Core::Timing& timing, u32 system_mode);
explicit KernelSystem(Memory::MemorySystem& memory, Core::Timing& timing,
std::function<void()> prepare_reschedule_callback, u32 system_mode);
~KernelSystem();
/**
@ -228,6 +230,10 @@ public:
/// Adds a port to the named port table
void AddNamedPort(std::string name, SharedPtr<ClientPort> port);
void PrepareReschedule() {
prepare_reschedule_callback();
}
/// Map of named ports managed by the kernel, which can be retrieved using the ConnectToPort
std::unordered_map<std::string, SharedPtr<ClientPort>> named_ports;
@ -238,6 +244,8 @@ public:
private:
void MemoryInit(u32 mem_type);
std::function<void()> prepare_reschedule_callback;
std::unique_ptr<ResourceLimitList> resource_limits;
std::atomic<u32> next_object_id{0};