summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_synchronization_object.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_synchronization_object.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/hle/kernel/k_synchronization_object.cpp b/src/core/hle/kernel/k_synchronization_object.cpp
index 82f72a0fe..45380dea0 100644
--- a/src/core/hle/kernel/k_synchronization_object.cpp
+++ b/src/core/hle/kernel/k_synchronization_object.cpp
@@ -13,18 +13,23 @@
namespace Kernel {
-ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
+void KSynchronizationObject::Finalize() {
+ this->OnFinalizeSynchronizationObject();
+ KAutoObject::Finalize();
+}
+
+ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, 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 = kernel.CurrentScheduler()->GetCurrentThread();
+ KThread* thread = kernel_ctx.CurrentScheduler()->GetCurrentThread();
{
// Setup the scheduling lock and sleep.
- KScopedSchedulerLockAndSleep slp{kernel, thread, timeout};
+ KScopedSchedulerLockAndSleep slp{kernel_ctx, thread, timeout};
// Check if any of the objects are already signaled.
for (auto i = 0; i < num_objects; ++i) {
@@ -89,13 +94,13 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
thread->SetWaitObjectsForDebugging({});
// Cancel the timer as needed.
- kernel.TimeManager().UnscheduleTimeEvent(thread);
+ kernel_ctx.TimeManager().UnscheduleTimeEvent(thread);
// Get the wait result.
ResultCode wait_result{RESULT_SUCCESS};
s32 sync_index = -1;
{
- KScopedSchedulerLock lock(kernel);
+ KScopedSchedulerLock lock(kernel_ctx);
KSynchronizationObject* synced_obj;
wait_result = thread->GetWaitResult(std::addressof(synced_obj));
@@ -130,10 +135,8 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
return wait_result;
}
-KSynchronizationObject::KSynchronizationObject(KernelCore& kernel) : Object{kernel} {}
-
-KSynchronizationObject::KSynchronizationObject(KernelCore& kernel, std::string&& name)
- : Object{kernel, std::move(name)} {}
+KSynchronizationObject::KSynchronizationObject(KernelCore& kernel_)
+ : KAutoObjectWithList{kernel_} {}
KSynchronizationObject::~KSynchronizationObject() = default;