diff options
author | Liam <byteslice@airmail.cc> | 2023-03-07 05:08:53 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-03-13 03:06:53 +0100 |
commit | 57f1d8ef8d8de7d93e46f6ec26811cfe4879249b (patch) | |
tree | 4c7a0c362845ea182130b68920686ad3151088b2 /src/core/hle/kernel/k_synchronization_object.cpp | |
parent | kernel: conver KScopedLock, KScopedResourceReservation, KSessionRequest, KSharedMemory, KSpinLock (diff) | |
download | yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.tar yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.tar.gz yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.tar.bz2 yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.tar.lz yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.tar.xz yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.tar.zst yuzu-57f1d8ef8d8de7d93e46f6ec26811cfe4879249b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_synchronization_object.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/core/hle/kernel/k_synchronization_object.cpp b/src/core/hle/kernel/k_synchronization_object.cpp index 40fd0c038..dd912a82d 100644 --- a/src/core/hle/kernel/k_synchronization_object.cpp +++ b/src/core/hle/kernel/k_synchronization_object.cpp @@ -71,26 +71,26 @@ void KSynchronizationObject::Finalize() { KAutoObject::Finalize(); } -Result KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index, +Result KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index, KSynchronizationObject** objects, const s32 num_objects, s64 timeout) { // Allocate space on stack for thread nodes. std::vector<ThreadListNode> thread_nodes(num_objects); // Prepare for wait. - KThread* thread = GetCurrentThreadPointer(kernel_ctx); + KThread* thread = GetCurrentThreadPointer(kernel); KHardwareTimer* timer{}; - ThreadQueueImplForKSynchronizationObjectWait wait_queue(kernel_ctx, objects, - thread_nodes.data(), num_objects); + ThreadQueueImplForKSynchronizationObjectWait wait_queue(kernel, objects, thread_nodes.data(), + num_objects); { // Setup the scheduling lock and sleep. - KScopedSchedulerLockAndSleep slp(kernel_ctx, std::addressof(timer), thread, timeout); + KScopedSchedulerLockAndSleep slp(kernel, std::addressof(timer), thread, timeout); // Check if the thread should terminate. if (thread->IsTerminationRequested()) { slp.CancelSleep(); - return ResultTerminationRequested; + R_THROW(ResultTerminationRequested); } // Check if any of the objects are already signaled. @@ -100,21 +100,21 @@ Result KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index, if (objects[i]->IsSignaled()) { *out_index = i; slp.CancelSleep(); - return ResultSuccess; + R_THROW(ResultSuccess); } } // Check if the timeout is zero. if (timeout == 0) { slp.CancelSleep(); - return ResultTimedOut; + R_THROW(ResultTimedOut); } // Check if waiting was canceled. if (thread->IsWaitCancelled()) { slp.CancelSleep(); thread->ClearWaitCancelled(); - return ResultCancelled; + R_THROW(ResultCancelled); } // Add the waiters. @@ -141,7 +141,7 @@ Result KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index, *out_index = thread->GetSyncedIndex(); // Get the wait result. - return thread->GetWaitResult(); + R_RETURN(thread->GetWaitResult()); } KSynchronizationObject::KSynchronizationObject(KernelCore& kernel_) @@ -158,7 +158,7 @@ void KSynchronizationObject::NotifyAvailable(Result result) { } // Iterate over each thread. - for (auto* cur_node = thread_list_head; cur_node != nullptr; cur_node = cur_node->next) { + for (auto* cur_node = m_thread_list_head; cur_node != nullptr; cur_node = cur_node->next) { cur_node->thread->NotifyAvailable(this, result); } } @@ -169,7 +169,7 @@ std::vector<KThread*> KSynchronizationObject::GetWaitingThreadsForDebugging() co // If debugging, dump the list of waiters. { KScopedSchedulerLock lock(kernel); - for (auto* cur_node = thread_list_head; cur_node != nullptr; cur_node = cur_node->next) { + for (auto* cur_node = m_thread_list_head; cur_node != nullptr; cur_node = cur_node->next) { threads.emplace_back(cur_node->thread); } } |