diff options
author | bunnei <bunneidev@gmail.com> | 2015-01-09 18:59:35 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-01-09 18:59:35 +0100 |
commit | 6ae12424df58f0ea171fc75ca4b700ab1fffc192 (patch) | |
tree | 93d87f3cb19d08541c6b8f8a9e0ceb730a2b13d9 /src/core/hle/kernel/semaphore.cpp | |
parent | Merge pull request #436 from kevinhartman/system-core (diff) | |
parent | Thread: Fix nullptr access in a logging function (diff) | |
download | yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.gz yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.bz2 yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.lz yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.xz yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.zst yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.zip |
Diffstat (limited to 'src/core/hle/kernel/semaphore.cpp')
-rw-r--r-- | src/core/hle/kernel/semaphore.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index 6bc8066a6..d7eeaa3da 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp @@ -37,8 +37,8 @@ public: bool wait = !IsAvailable(); if (wait) { - Kernel::WaitCurrentThread(WAITTYPE_SEMA, GetHandle()); - waiting_threads.push(GetCurrentThreadHandle()); + Kernel::WaitCurrentThread(WAITTYPE_SEMA, this); + waiting_threads.push(GetCurrentThread()->GetHandle()); } else { --available_count; } @@ -84,7 +84,9 @@ ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) { // Notify some of the threads that the semaphore has been released // stop once the semaphore is full again or there are no more waiting threads while (!semaphore->waiting_threads.empty() && semaphore->IsAvailable()) { - Kernel::ResumeThreadFromWait(semaphore->waiting_threads.front()); + Thread* thread = Kernel::g_handle_table.Get<Thread>(semaphore->waiting_threads.front()); + if (thread != nullptr) + thread->ResumeFromWait(); semaphore->waiting_threads.pop(); --semaphore->available_count; } |