summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_synchronization_object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/k_synchronization_object.cpp')
-rw-r--r--src/core/hle/kernel/k_synchronization_object.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/core/hle/kernel/k_synchronization_object.cpp b/src/core/hle/kernel/k_synchronization_object.cpp
index 1c508cb55..a3b34f82f 100644
--- a/src/core/hle/kernel/k_synchronization_object.cpp
+++ b/src/core/hle/kernel/k_synchronization_object.cpp
@@ -7,9 +7,9 @@
#include "core/hle/kernel/k_scheduler.h"
#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
#include "core/hle/kernel/k_synchronization_object.h"
+#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/svc_results.h"
-#include "core/hle/kernel/thread.h"
namespace Kernel {
@@ -20,12 +20,11 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
std::vector<ThreadListNode> thread_nodes(num_objects);
// Prepare for wait.
- Thread* thread = kernel.CurrentScheduler()->GetCurrentThread();
- Handle timer = InvalidHandle;
+ KThread* thread = kernel.CurrentScheduler()->GetCurrentThread();
{
// Setup the scheduling lock and sleep.
- KScopedSchedulerLockAndSleep slp(kernel, timer, thread, timeout);
+ KScopedSchedulerLockAndSleep slp{kernel, thread, timeout};
// Check if any of the objects are already signaled.
for (auto i = 0; i < num_objects; ++i) {
@@ -90,10 +89,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
thread->SetWaitObjectsForDebugging({});
// Cancel the timer as needed.
- if (timer != InvalidHandle) {
- auto& time_manager = kernel.TimeManager();
- time_manager.UnscheduleTimeEvent(timer);
- }
+ kernel.TimeManager().UnscheduleTimeEvent(thread);
// Get the wait result.
ResultCode wait_result{RESULT_SUCCESS};
@@ -136,7 +132,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
KSynchronizationObject::KSynchronizationObject(KernelCore& kernel) : Object{kernel} {}
-KSynchronizationObject ::~KSynchronizationObject() = default;
+KSynchronizationObject::~KSynchronizationObject() = default;
void KSynchronizationObject::NotifyAvailable(ResultCode result) {
KScopedSchedulerLock lock(kernel);
@@ -148,7 +144,7 @@ void KSynchronizationObject::NotifyAvailable(ResultCode result) {
// Iterate over each thread.
for (auto* cur_node = thread_list_head; cur_node != nullptr; cur_node = cur_node->next) {
- Thread* thread = cur_node->thread;
+ KThread* thread = cur_node->thread;
if (thread->GetState() == ThreadState::Waiting) {
thread->SetSyncedObject(this, result);
thread->SetState(ThreadState::Runnable);
@@ -156,8 +152,8 @@ void KSynchronizationObject::NotifyAvailable(ResultCode result) {
}
}
-std::vector<Thread*> KSynchronizationObject::GetWaitingThreadsForDebugging() const {
- std::vector<Thread*> threads;
+std::vector<KThread*> KSynchronizationObject::GetWaitingThreadsForDebugging() const {
+ std::vector<KThread*> threads;
// If debugging, dump the list of waiters.
{