diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-27 00:31:22 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-29 14:42:26 +0100 |
commit | c7133838161ce0c17276ef96c0decfb855510165 (patch) | |
tree | 35041d92a238d3c2952f0ef486da0214cdc7e267 /src/core/hle/kernel/readable_event.h | |
parent | kernel/object: Add descriptions to ResetTypes (diff) | |
download | yuzu-c7133838161ce0c17276ef96c0decfb855510165.tar yuzu-c7133838161ce0c17276ef96c0decfb855510165.tar.gz yuzu-c7133838161ce0c17276ef96c0decfb855510165.tar.bz2 yuzu-c7133838161ce0c17276ef96c0decfb855510165.tar.lz yuzu-c7133838161ce0c17276ef96c0decfb855510165.tar.xz yuzu-c7133838161ce0c17276ef96c0decfb855510165.tar.zst yuzu-c7133838161ce0c17276ef96c0decfb855510165.zip |
Diffstat (limited to 'src/core/hle/kernel/readable_event.h')
-rw-r--r-- | src/core/hle/kernel/readable_event.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/core/hle/kernel/readable_event.h b/src/core/hle/kernel/readable_event.h new file mode 100644 index 000000000..020ef4ebc --- /dev/null +++ b/src/core/hle/kernel/readable_event.h @@ -0,0 +1,56 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/kernel/object.h" +#include "core/hle/kernel/wait_object.h" + +namespace Kernel { + +class KernelCore; +class WritableEvent; + +class ReadableEvent final : public WaitObject { + friend class WritableEvent; + +public: + ~ReadableEvent() override; + + std::string GetTypeName() const override { + return "ReadableEvent"; + } + std::string GetName() const override { + return name; + } + + static const HandleType HANDLE_TYPE = HandleType::Event; + HandleType GetHandleType() const override { + return HANDLE_TYPE; + } + + bool ShouldWait(Thread* thread) const override; + void Acquire(Thread* thread) override; + + void WakeupAllWaitingThreads() override; + + void AddWaitingThread(SharedPtr<Thread> thread) override; + void RemoveWaitingThread(Thread* thread) override; + + void Signal(); + void Clear(); + + SharedPtr<WritableEvent> PromoteToWritable() const { + return writable_event; + } + +private: + explicit ReadableEvent(KernelCore& kernel); + + SharedPtr<WritableEvent> writable_event; ///< WritableEvent associated with this ReadableEvent + + std::string name; ///< Name of event (optional) +}; + +} // namespace Kernel |