diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-08 08:30:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 08:30:17 +0200 |
commit | faa067f175cbf5e916ed75776817f0046e6731c4 (patch) | |
tree | 8ab02a72a6e4d6578848c8da2c02af02684aeec7 /src/core/hle/kernel/k_event.h | |
parent | Merge pull request #6287 from lioncash/ldr-copy (diff) | |
parent | hle: kernel: KPageTable: CanContain should not be constexpr. (diff) | |
download | yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.gz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.bz2 yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.lz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.xz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.zst yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.zip |
Diffstat (limited to 'src/core/hle/kernel/k_event.h')
-rw-r--r-- | src/core/hle/kernel/k_event.h | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/core/hle/kernel/k_event.h b/src/core/hle/kernel/k_event.h index 2fb887129..4ca869930 100644 --- a/src/core/hle/kernel/k_event.h +++ b/src/core/hle/kernel/k_event.h @@ -4,53 +4,54 @@ #pragma once -#include "core/hle/kernel/object.h" +#include "core/hle/kernel/k_readable_event.h" +#include "core/hle/kernel/k_writable_event.h" +#include "core/hle/kernel/slab_helpers.h" namespace Kernel { class KernelCore; class KReadableEvent; class KWritableEvent; +class KProcess; -class KEvent final : public Object { -public: - explicit KEvent(KernelCore& kernel, std::string&& name); - ~KEvent() override; +class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> { + KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject); - static std::shared_ptr<KEvent> Create(KernelCore& kernel, std::string&& name); +public: + explicit KEvent(KernelCore& kernel); + virtual ~KEvent(); - void Initialize(); + void Initialize(std::string&& name); - void Finalize() override {} + virtual void Finalize() override; - std::string GetTypeName() const override { - return "KEvent"; + virtual bool IsInitialized() const override { + return initialized; } - static constexpr HandleType HANDLE_TYPE = HandleType::Event; - HandleType GetHandleType() const override { - return HANDLE_TYPE; + virtual uintptr_t GetPostDestroyArgument() const override { + return reinterpret_cast<uintptr_t>(owner); } - std::shared_ptr<KReadableEvent>& GetReadableEvent() { - return readable_event; - } + static void PostDestroy(uintptr_t arg); - std::shared_ptr<KWritableEvent>& GetWritableEvent() { - return writable_event; + virtual KProcess* GetOwner() const override { + return owner; } - const std::shared_ptr<KReadableEvent>& GetReadableEvent() const { + KReadableEvent& GetReadableEvent() { return readable_event; } - const std::shared_ptr<KWritableEvent>& GetWritableEvent() const { + KWritableEvent& GetWritableEvent() { return writable_event; } private: - std::shared_ptr<KReadableEvent> readable_event; - std::shared_ptr<KWritableEvent> writable_event; + KReadableEvent readable_event; + KWritableEvent writable_event; + KProcess* owner{}; bool initialized{}; }; |