hle: kernel: Migrate KEvent to KAutoObject.

This commit is contained in:
bunnei
2021-04-04 00:56:09 -07:00
parent 086db71e94
commit addc0bf037
37 changed files with 269 additions and 266 deletions

View File

@ -4,24 +4,34 @@
#pragma once
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/slab_helpers.h"
namespace Kernel {
class KernelCore;
class KReadableEvent;
class KWritableEvent;
class Process;
class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> {
KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject);
class KEvent final : public Object {
public:
explicit KEvent(KernelCore& kernel, std::string&& name);
explicit KEvent(KernelCore& kernel);
~KEvent() override;
static std::shared_ptr<KEvent> Create(KernelCore& kernel, std::string&& name);
void Initialize(std::string&& name);
void Initialize();
virtual void Finalize() override;
void Finalize() override {}
virtual bool IsInitialized() const override {
return initialized;
}
virtual uintptr_t GetPostDestroyArgument() const override {
return reinterpret_cast<uintptr_t>(owner);
}
static void PostDestroy(uintptr_t arg);
std::string GetTypeName() const override {
return "KEvent";
@ -51,6 +61,7 @@ public:
private:
std::shared_ptr<KReadableEvent> readable_event;
std::shared_ptr<KWritableEvent> writable_event;
Process* owner{};
bool initialized{};
};