diff options
author | Lioncash <mathew1800@gmail.com> | 2018-12-05 00:54:18 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-12-05 02:14:55 +0100 |
commit | a3aa7aaf0be9d95766b9c123b7c32b6505084c3c (patch) | |
tree | 1781f48332b8b58303baeac93654bc247b87bf94 /src/core | |
parent | Merge pull request #1838 from lioncash/dedup (diff) | |
download | yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.tar yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.tar.gz yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.tar.bz2 yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.tar.lz yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.tar.xz yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.tar.zst yuzu-a3aa7aaf0be9d95766b9c123b7c32b6505084c3c.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/kernel/readable_event.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/kernel/readable_event.h | 11 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/core/hle/kernel/readable_event.cpp b/src/core/hle/kernel/readable_event.cpp index 92e16b4e6..ba01f495c 100644 --- a/src/core/hle/kernel/readable_event.cpp +++ b/src/core/hle/kernel/readable_event.cpp @@ -4,10 +4,10 @@ #include <algorithm> #include "common/assert.h" +#include "core/hle/kernel/errors.h" #include "core/hle/kernel/object.h" #include "core/hle/kernel/readable_event.h" #include "core/hle/kernel/thread.h" -#include "core/hle/kernel/writable_event.h" namespace Kernel { @@ -34,6 +34,16 @@ void ReadableEvent::Clear() { signaled = false; } +ResultCode ReadableEvent::Reset() { + if (!signaled) { + return ERR_INVALID_STATE; + } + + Clear(); + + return RESULT_SUCCESS; +} + void ReadableEvent::WakeupAllWaitingThreads() { WaitObject::WakeupAllWaitingThreads(); diff --git a/src/core/hle/kernel/readable_event.h b/src/core/hle/kernel/readable_event.h index 867ff3051..80b3b0aba 100644 --- a/src/core/hle/kernel/readable_event.h +++ b/src/core/hle/kernel/readable_event.h @@ -7,6 +7,8 @@ #include "core/hle/kernel/object.h" #include "core/hle/kernel/wait_object.h" +union ResultCode; + namespace Kernel { class KernelCore; @@ -39,8 +41,17 @@ public: void WakeupAllWaitingThreads() override; + /// Unconditionally clears the readable event's state. void Clear(); + /// Clears the readable event's state if and only if it + /// has already been signaled. + /// + /// @pre The event must be in a signaled state. If this event + /// is in an unsignaled state and this function is called, + /// then ERR_INVALID_STATE will be returned. + ResultCode Reset(); + private: explicit ReadableEvent(KernelCore& kernel); |