summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/event.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2015-01-09 12:59:35 -0500
committerGravatar bunnei2015-01-09 12:59:35 -0500
commit6ae12424df58f0ea171fc75ca4b700ab1fffc192 (patch)
tree93d87f3cb19d08541c6b8f8a9e0ceb730a2b13d9 /src/core/hle/kernel/event.cpp
parentMerge pull request #436 from kevinhartman/system-core (diff)
parentThread: Fix nullptr access in a logging function (diff)
downloadyuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.gz
yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.xz
yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.zip
Merge pull request #444 from yuriks/handle-reform2
Kernel Lifetime Reform Pt. 2
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,