diff options
author | bunnei <bunneidev@gmail.com> | 2021-01-30 08:51:40 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-02-05 23:00:36 +0100 |
commit | 3f942c01f0d8c42837c49a164ed78f6410d62bda (patch) | |
tree | c060645e1c90727ef7cb4c26334e8ed32ff7f577 /src/core/hle/kernel/k_writable_event.h | |
parent | hle: kernel: Rename ReadableEvent to KReadableEvent. (diff) | |
download | yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.tar yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.tar.gz yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.tar.bz2 yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.tar.lz yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.tar.xz yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.tar.zst yuzu-3f942c01f0d8c42837c49a164ed78f6410d62bda.zip |
Diffstat (limited to 'src/core/hle/kernel/k_writable_event.h')
-rw-r--r-- | src/core/hle/kernel/k_writable_event.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_writable_event.h b/src/core/hle/kernel/k_writable_event.h new file mode 100644 index 000000000..ad5514b52 --- /dev/null +++ b/src/core/hle/kernel/k_writable_event.h @@ -0,0 +1,60 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <memory> + +#include "core/hle/kernel/object.h" + +namespace Kernel { + +class KernelCore; +class KReadableEvent; +class KWritableEvent; + +struct EventPair { + std::shared_ptr<KReadableEvent> readable; + std::shared_ptr<KWritableEvent> writable; +}; + +class KWritableEvent final : public Object { +public: + ~KWritableEvent() override; + + /** + * Creates an event + * @param kernel The kernel instance to create this event under. + * @param name Optional name of event + */ + static EventPair CreateEventPair(KernelCore& kernel, std::string name = "Unknown"); + + std::string GetTypeName() const override { + return "WritableEvent"; + } + std::string GetName() const override { + return name; + } + + static constexpr HandleType HANDLE_TYPE = HandleType::WritableEvent; + HandleType GetHandleType() const override { + return HANDLE_TYPE; + } + + std::shared_ptr<KReadableEvent> GetReadableEvent() const; + + void Signal(); + void Clear(); + + void Finalize() override {} + +private: + explicit KWritableEvent(KernelCore& kernel); + + std::shared_ptr<KReadableEvent> readable; + + std::string name; ///< Name of event (optional) +}; + +} // namespace Kernel |