diff options
Diffstat (limited to 'src/core/hle/kernel/event.cpp')
| -rw-r--r-- | src/core/hle/kernel/event.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index e0117c0bc..8a2925a3c 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp | |||
| @@ -35,8 +35,8 @@ public: | |||
| 35 | * @param wait Boolean wait set if current thread should wait as a result of sync operation | 35 | * @param wait Boolean wait set if current thread should wait as a result of sync operation |
| 36 | * @return Result of operation, 0 on success, otherwise error code | 36 | * @return Result of operation, 0 on success, otherwise error code |
| 37 | */ | 37 | */ |
| 38 | Result WaitSynchronization(bool* wait) override { | 38 | ResultVal<bool> WaitSynchronization() override { |
| 39 | *wait = locked; | 39 | bool wait = locked; |
| 40 | if (locked) { | 40 | if (locked) { |
| 41 | Handle thread = GetCurrentThreadHandle(); | 41 | Handle thread = GetCurrentThreadHandle(); |
| 42 | if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { | 42 | if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { |
| @@ -47,7 +47,7 @@ public: | |||
| 47 | if (reset_type != RESETTYPE_STICKY && !permanent_locked) { | 47 | if (reset_type != RESETTYPE_STICKY && !permanent_locked) { |
| 48 | locked = true; | 48 | locked = true; |
| 49 | } | 49 | } |
| 50 | return 0; | 50 | return MakeResult<bool>(wait); |
| 51 | } | 51 | } |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| @@ -57,12 +57,12 @@ public: | |||
| 57 | * @param permanent_locked Boolean permanent locked value to set event | 57 | * @param permanent_locked Boolean permanent locked value to set event |
| 58 | * @return Result of operation, 0 on success, otherwise error code | 58 | * @return Result of operation, 0 on success, otherwise error code |
| 59 | */ | 59 | */ |
| 60 | Result SetPermanentLock(Handle handle, const bool permanent_locked) { | 60 | ResultCode SetPermanentLock(Handle handle, const bool permanent_locked) { |
| 61 | Event* evt = g_object_pool.GetFast<Event>(handle); | 61 | Event* evt = g_object_pool.Get<Event>(handle); |
| 62 | _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); | 62 | if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); |
| 63 | 63 | ||
| 64 | evt->permanent_locked = permanent_locked; | 64 | evt->permanent_locked = permanent_locked; |
| 65 | return 0; | 65 | return RESULT_SUCCESS; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | /** | 68 | /** |
| @@ -71,14 +71,14 @@ Result SetPermanentLock(Handle handle, const bool permanent_locked) { | |||
| 71 | * @param locked Boolean locked value to set event | 71 | * @param locked Boolean locked value to set event |
| 72 | * @return Result of operation, 0 on success, otherwise error code | 72 | * @return Result of operation, 0 on success, otherwise error code |
| 73 | */ | 73 | */ |
| 74 | Result SetEventLocked(const Handle handle, const bool locked) { | 74 | ResultCode SetEventLocked(const Handle handle, const bool locked) { |
| 75 | Event* evt = g_object_pool.GetFast<Event>(handle); | 75 | Event* evt = g_object_pool.Get<Event>(handle); |
| 76 | _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); | 76 | if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); |
| 77 | 77 | ||
| 78 | if (!evt->permanent_locked) { | 78 | if (!evt->permanent_locked) { |
| 79 | evt->locked = locked; | 79 | evt->locked = locked; |
| 80 | } | 80 | } |
| 81 | return 0; | 81 | return RESULT_SUCCESS; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /** | 84 | /** |
| @@ -86,9 +86,9 @@ Result SetEventLocked(const Handle handle, const bool locked) { | |||
| 86 | * @param handle Handle to event to signal | 86 | * @param handle Handle to event to signal |
| 87 | * @return Result of operation, 0 on success, otherwise error code | 87 | * @return Result of operation, 0 on success, otherwise error code |
| 88 | */ | 88 | */ |
| 89 | Result SignalEvent(const Handle handle) { | 89 | ResultCode SignalEvent(const Handle handle) { |
| 90 | Event* evt = g_object_pool.GetFast<Event>(handle); | 90 | Event* evt = g_object_pool.Get<Event>(handle); |
| 91 | _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); | 91 | if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); |
| 92 | 92 | ||
| 93 | // Resume threads waiting for event to signal | 93 | // Resume threads waiting for event to signal |
| 94 | bool event_caught = false; | 94 | bool event_caught = false; |
| @@ -106,7 +106,7 @@ Result SignalEvent(const Handle handle) { | |||
| 106 | if (!evt->permanent_locked) { | 106 | if (!evt->permanent_locked) { |
| 107 | evt->locked = event_caught; | 107 | evt->locked = event_caught; |
| 108 | } | 108 | } |
| 109 | return 0; | 109 | return RESULT_SUCCESS; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| @@ -114,14 +114,14 @@ Result SignalEvent(const Handle handle) { | |||
| 114 | * @param handle Handle to event to clear | 114 | * @param handle Handle to event to clear |
| 115 | * @return Result of operation, 0 on success, otherwise error code | 115 | * @return Result of operation, 0 on success, otherwise error code |
| 116 | */ | 116 | */ |
| 117 | Result ClearEvent(Handle handle) { | 117 | ResultCode ClearEvent(Handle handle) { |
| 118 | Event* evt = g_object_pool.GetFast<Event>(handle); | 118 | Event* evt = g_object_pool.Get<Event>(handle); |
| 119 | _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); | 119 | if (evt == nullptr) return InvalidHandle(ErrorModule::Kernel); |
| 120 | 120 | ||
| 121 | if (!evt->permanent_locked) { | 121 | if (!evt->permanent_locked) { |
| 122 | evt->locked = true; | 122 | evt->locked = true; |
| 123 | } | 123 | } |
| 124 | return 0; | 124 | return RESULT_SUCCESS; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | /** | 127 | /** |