mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-25 19:40:07 +00:00
kernel: Add named event table
Used to store ReadableEvents of all events on the system.
This commit is contained in:
parent
c713383816
commit
c61d2a2841
@ -17,9 +17,11 @@
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/readable_event.h"
|
||||
#include "core/hle/kernel/resource_limit.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/timer.h"
|
||||
#include "core/hle/kernel/writable_event.h"
|
||||
#include "core/hle/lock.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
@ -175,6 +177,10 @@ struct KernelCore::Impl {
|
||||
// allowing us to simply use a pool index or similar.
|
||||
Kernel::HandleTable thread_wakeup_callback_handle_table;
|
||||
|
||||
/// Map of named events managed by the kernel, which are retrieved when HLE services need to
|
||||
/// return an event to the system.
|
||||
NamedEventTable named_events;
|
||||
|
||||
/// Map of named ports managed by the kernel, which can be retrieved using
|
||||
/// the ConnectToPort SVC.
|
||||
NamedPortTable named_ports;
|
||||
@ -221,6 +227,19 @@ const Process* KernelCore::CurrentProcess() const {
|
||||
return impl->current_process;
|
||||
}
|
||||
|
||||
void KernelCore::AddNamedEvent(std::string name, SharedPtr<ReadableEvent> event) {
|
||||
impl->named_events.emplace(std::move(name), std::move(event));
|
||||
}
|
||||
|
||||
KernelCore::NamedEventTable::iterator KernelCore::FindNamedEvent(const std::string& name) {
|
||||
return impl->named_events.find(name);
|
||||
}
|
||||
|
||||
KernelCore::NamedEventTable::const_iterator KernelCore::FindNamedEvent(
|
||||
const std::string& name) const {
|
||||
return impl->named_events.find(name);
|
||||
}
|
||||
|
||||
void KernelCore::AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
|
||||
impl->named_ports.emplace(std::move(name), std::move(port));
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace Kernel {
|
||||
class ClientPort;
|
||||
class HandleTable;
|
||||
class Process;
|
||||
class ReadableEvent;
|
||||
class ResourceLimit;
|
||||
class Thread;
|
||||
class Timer;
|
||||
@ -27,6 +28,7 @@ class Timer;
|
||||
/// Represents a single instance of the kernel.
|
||||
class KernelCore {
|
||||
private:
|
||||
using NamedEventTable = std::unordered_map<std::string, SharedPtr<ReadableEvent>>;
|
||||
using NamedPortTable = std::unordered_map<std::string, SharedPtr<ClientPort>>;
|
||||
|
||||
public:
|
||||
@ -66,6 +68,15 @@ public:
|
||||
/// Retrieves a const pointer to the current process.
|
||||
const Process* CurrentProcess() const;
|
||||
|
||||
/// Adds an event to the named event table
|
||||
void AddNamedEvent(std::string name, SharedPtr<ReadableEvent> event);
|
||||
|
||||
/// Finds an event within the named event table wit the given name.
|
||||
NamedEventTable::iterator FindNamedEvent(const std::string& name);
|
||||
|
||||
/// Finds an event within the named event table wit the given name.
|
||||
NamedEventTable::const_iterator FindNamedEvent(const std::string& name) const;
|
||||
|
||||
/// Adds a port to the named port table
|
||||
void AddNamedPort(std::string name, SharedPtr<ClientPort> port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user