aboutsummaryrefslogtreecommitdiff
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.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/core/hle/kernel/k_synchronization_object.cpp b/src/core/hle/kernel/k_synchronization_object.cpp
index 3e5b735b1e..221cab655f 100644
--- a/src/core/hle/kernel/k_synchronization_object.cpp
+++ b/src/core/hle/kernel/k_synchronization_object.cpp
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -18,12 +21,10 @@ namespace {
class ThreadQueueImplForKSynchronizationObjectWait final : public KThreadQueueWithoutEndWait {
public:
- ThreadQueueImplForKSynchronizationObjectWait(KernelCore& kernel, KSynchronizationObject** o,
- KSynchronizationObject::ThreadListNode* n, s32 c)
+ ThreadQueueImplForKSynchronizationObjectWait(KernelCore& kernel, KSynchronizationObject** o, KSynchronizationObject::ThreadListNode* n, s32 c)
: KThreadQueueWithoutEndWait(kernel), m_objects(o), m_nodes(n), m_count(c) {}
- void NotifyAvailable(KThread* waiting_thread, KSynchronizationObject* signaled_object,
- Result wait_result) override {
+ void NotifyAvailable(KernelCore& kernel, KThread* waiting_thread, KSynchronizationObject* signaled_object, Result wait_result) override {
// Determine the sync index, and unlink all nodes.
s32 sync_index = -1;
for (auto i = 0; i < m_count; ++i) {
@@ -43,10 +44,10 @@ public:
waiting_thread->ClearCancellable();
// Invoke the base end wait handler.
- KThreadQueue::EndWait(waiting_thread, wait_result);
+ KThreadQueue::EndWait(kernel, waiting_thread, wait_result);
}
- void CancelWait(KThread* waiting_thread, Result wait_result, bool cancel_timer_task) override {
+ void CancelWait(KernelCore& kernel, KThread* waiting_thread, Result wait_result, bool cancel_timer_task) override {
// Remove all nodes from our list.
for (auto i = 0; i < m_count; ++i) {
m_objects[i]->UnlinkNode(std::addressof(m_nodes[i]));
@@ -56,7 +57,7 @@ public:
waiting_thread->ClearCancellable();
// Invoke the base cancel wait handler.
- KThreadQueue::CancelWait(waiting_thread, wait_result, cancel_timer_task);
+ KThreadQueue::CancelWait(kernel, waiting_thread, wait_result, cancel_timer_task);
}
private:
@@ -67,9 +68,9 @@ private:
} // namespace
-void KSynchronizationObject::Finalize() {
+void KSynchronizationObject::Finalize(KernelCore& kernel) {
this->OnFinalizeSynchronizationObject();
- KAutoObject::Finalize();
+ KAutoObject::Finalize(kernel);
}
Result KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
@@ -98,7 +99,7 @@ Result KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
for (auto i = 0; i < num_objects; ++i) {
ASSERT(objects[i] != nullptr);
- if (objects[i]->IsSignaled()) {
+ if (objects[i]->IsSignaled(kernel)) {
*out_index = i;
slp.CancelSleep();
R_THROW(ResultSuccess);
@@ -134,7 +135,7 @@ Result KSynchronizationObject::Wait(KernelCore& kernel, s32* out_index,
// Wait for an object to be signaled.
wait_queue.SetHardwareTimer(timer);
- thread->BeginWait(std::addressof(wait_queue));
+ thread->BeginWait(kernel, std::addressof(wait_queue));
thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Synchronization);
}
@@ -149,26 +150,26 @@ KSynchronizationObject::KSynchronizationObject(KernelCore& kernel) : KAutoObject
KSynchronizationObject::~KSynchronizationObject() = default;
-void KSynchronizationObject::NotifyAvailable(Result result) {
- KScopedSchedulerLock sl(m_kernel);
+void KSynchronizationObject::NotifyAvailable(KernelCore& kernel, Result result) {
+ KScopedSchedulerLock sl(kernel);
// If we're not signaled, we've nothing to notify.
- if (!this->IsSignaled()) {
+ if (!this->IsSignaled(kernel)) {
return;
}
// Iterate over each thread.
for (auto* cur_node = m_thread_list_head; cur_node != nullptr; cur_node = cur_node->next) {
- cur_node->thread->NotifyAvailable(this, result);
+ cur_node->thread->NotifyAvailable(kernel, this, result);
}
}
-std::vector<KThread*> KSynchronizationObject::GetWaitingThreadsForDebugging() const {
+std::vector<KThread*> KSynchronizationObject::GetWaitingThreadsForDebugging(KernelCore& kernel) const {
std::vector<KThread*> threads;
// If debugging, dump the list of waiters.
{
- KScopedSchedulerLock lock(m_kernel);
+ KScopedSchedulerLock lock(kernel);
for (auto* cur_node = m_thread_list_head; cur_node != nullptr; cur_node = cur_node->next) {
threads.emplace_back(cur_node->thread);
}