VERY experimental Nintendo Switch 2 emulator
C++
kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const
Lioncashf842f4c6993f
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cppindex b0b7af76bd..6e98d78a28 100644--- a/src/core/hle/kernel/process.cpp+++ b/src/core/hle/kernel/process.cpp@@ -247,7 +247,7 @@ void Process::Acquire(Thread* thread) {ASSERT_MSG(!ShouldWait(thread), "Object unavailable!");}-bool Process::ShouldWait(Thread* thread) const {+bool Process::ShouldWait(const Thread* thread) const {return !is_signaled;}diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.hindex 732d121706..23f898b0cc 100644--- a/src/core/hle/kernel/process.h+++ b/src/core/hle/kernel/process.h@@ -237,7 +237,7 @@ private:~Process() override;/// Checks if the specified thread should wait until this process is available.- bool ShouldWait(Thread* thread) const override;+ bool ShouldWait(const Thread* thread) const override;/// Acquires/locks this process for the specified thread if it's available.void Acquire(Thread* thread) override;diff --git a/src/core/hle/kernel/readable_event.cpp b/src/core/hle/kernel/readable_event.cppindex 0e5083f705..c2b798a4e7 100644--- a/src/core/hle/kernel/readable_event.cpp+++ b/src/core/hle/kernel/readable_event.cpp@@ -14,7 +14,7 @@ namespace Kernel {ReadableEvent::ReadableEvent(KernelCore& kernel) : WaitObject{kernel} {}ReadableEvent::~ReadableEvent() = default;-bool ReadableEvent::ShouldWait(Thread* thread) const {+bool ReadableEvent::ShouldWait(const Thread* thread) const {return !signaled;}diff --git a/src/core/hle/kernel/readable_event.h b/src/core/hle/kernel/readable_event.hindex 77a9c362cb..2eb9dcbb78 100644--- a/src/core/hle/kernel/readable_event.h+++ b/src/core/hle/kernel/readable_event.h@@ -36,7 +36,7 @@ public:return HANDLE_TYPE;}- bool ShouldWait(Thread* thread) const override;+ bool ShouldWait(const Thread* thread) const override;void Acquire(Thread* thread) override;/// Unconditionally clears the readable event's state.diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cppindex 0e1515c890..708fdf9e1a 100644--- a/src/core/hle/kernel/server_port.cpp+++ b/src/core/hle/kernel/server_port.cpp@@ -30,7 +30,7 @@ void ServerPort::AppendPendingSession(SharedPtr<ServerSession> pending_session)pending_sessions.push_back(std::move(pending_session));}-bool ServerPort::ShouldWait(Thread* thread) const {+bool ServerPort::ShouldWait(const Thread* thread) const {// If there are no pending sessions, we wait until a new one is added.return pending_sessions.empty();}diff --git a/src/core/hle/kernel/server_port.h b/src/core/hle/kernel/server_port.hindex 9bc667cf2c..76293cb8b1 100644--- a/src/core/hle/kernel/server_port.h+++ b/src/core/hle/kernel/server_port.h@@ -75,7 +75,7 @@ public:/// waiting to be accepted by this port.void AppendPendingSession(SharedPtr<ServerSession> pending_session);- bool ShouldWait(Thread* thread) const override;+ bool ShouldWait(const Thread* thread) const override;void Acquire(Thread* thread) override;private:diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cppindex 4d8a337a76..40cec143e1 100644--- a/src/core/hle/kernel/server_session.cpp+++ b/src/core/hle/kernel/server_session.cpp@@ -46,7 +46,7 @@ ResultVal<SharedPtr<ServerSession>> ServerSession::Create(KernelCore& kernel, streturn MakeResult(std::move(server_session));}-bool ServerSession::ShouldWait(Thread* thread) const {+bool ServerSession::ShouldWait(const Thread* thread) const {// Closed sessions should never wait, an error will be returned from svcReplyAndReceive.if (parent->client == nullptr)return false;diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.hindex aea4ccfebf..79b84baded 100644--- a/src/core/hle/kernel/server_session.h+++ b/src/core/hle/kernel/server_session.h@@ -82,7 +82,7 @@ public:*/ResultCode HandleSyncRequest(SharedPtr<Thread> thread);- bool ShouldWait(Thread* thread) const override;+ bool ShouldWait(const Thread* thread) const override;void Acquire(Thread* thread) override;diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cppindex 332f962877..0e4f6c0411 100644--- a/src/core/hle/kernel/thread.cpp+++ b/src/core/hle/kernel/thread.cpp@@ -28,7 +28,7 @@namespace Kernel {-bool Thread::ShouldWait(Thread* thread) const {+bool Thread::ShouldWait(const Thread* thread) const {return status != ThreadStatus::Dead;}diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.hindex 1e36a96158..db563708bb 100644--- a/src/core/hle/kernel/thread.h+++ b/src/core/hle/kernel/thread.h@@ -111,7 +111,7 @@ public:return HANDLE_TYPE;}- bool ShouldWait(Thread* thread) const override;+ bool ShouldWait(const Thread* thread) const override;void Acquire(Thread* thread) override;/**diff --git a/src/core/hle/kernel/wait_object.h b/src/core/hle/kernel/wait_object.hindex 5987fb9716..04464a51aa 100644--- a/src/core/hle/kernel/wait_object.h+++ b/src/core/hle/kernel/wait_object.h@@ -24,7 +24,7 @@ public:* @param thread The thread about which we're deciding.* @return True if the current thread should wait due to this object being unavailable*/- virtual bool ShouldWait(Thread* thread) const = 0;+ virtual bool ShouldWait(const Thread* thread) const = 0;/// Acquire/lock the object for the specified thread if it is availablevirtual void Acquire(Thread* thread) = 0;