summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/event.cpp')
-rw-r--r--src/core/hle/kernel/event.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index e43c3ee4e..697e08681 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -33,11 +33,11 @@ public:
33 ResultVal<bool> WaitSynchronization() override { 33 ResultVal<bool> WaitSynchronization() override {
34 bool wait = locked; 34 bool wait = locked;
35 if (locked) { 35 if (locked) {
36 Handle thread = GetCurrentThreadHandle(); 36 Handle thread = GetCurrentThread()->GetHandle();
37 if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { 37 if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) {
38 waiting_threads.push_back(thread); 38 waiting_threads.push_back(thread);
39 } 39 }
40 Kernel::WaitCurrentThread(WAITTYPE_EVENT, GetHandle()); 40 Kernel::WaitCurrentThread(WAITTYPE_EVENT, this);
41 } 41 }
42 if (reset_type != RESETTYPE_STICKY && !permanent_locked) { 42 if (reset_type != RESETTYPE_STICKY && !permanent_locked) {
43 locked = true; 43 locked = true;
@@ -88,7 +88,9 @@ ResultCode SignalEvent(const Handle handle) {
88 // Resume threads waiting for event to signal 88 // Resume threads waiting for event to signal
89 bool event_caught = false; 89 bool event_caught = false;
90 for (size_t i = 0; i < evt->waiting_threads.size(); ++i) { 90 for (size_t i = 0; i < evt->waiting_threads.size(); ++i) {
91 ResumeThreadFromWait( evt->waiting_threads[i]); 91 Thread* thread = Kernel::g_handle_table.Get<Thread>(evt->waiting_threads[i]);
92 if (thread != nullptr)
93 thread->ResumeFromWait();
92 94
93 // If any thread is signalled awake by this event, assume the event was "caught" and reset 95 // If any thread is signalled awake by this event, assume the event was "caught" and reset
94 // the event. This will result in the next thread waiting on the event to block. Otherwise, 96 // the event. This will result in the next thread waiting on the event to block. Otherwise,