diff options
author | Liam <byteslice@airmail.cc> | 2023-12-07 01:54:52 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-12-07 15:13:43 +0100 |
commit | 9268f265a1207f0cddb97a908a1cc349f9b6410b (patch) | |
tree | 5da6aea714523b3504b78362c5d8abd53689d72f /src/core/hle/kernel/k_server_port.cpp | |
parent | Merge pull request #12236 from liamwhite/cpu-refactor (diff) | |
download | yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.tar yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.tar.gz yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.tar.bz2 yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.tar.lz yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.tar.xz yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.tar.zst yuzu-9268f265a1207f0cddb97a908a1cc349f9b6410b.zip |
Diffstat (limited to 'src/core/hle/kernel/k_server_port.cpp')
-rw-r--r-- | src/core/hle/kernel/k_server_port.cpp | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_server_port.cpp b/src/core/hle/kernel/k_server_port.cpp index a29d34bc1..bb6632f58 100644 --- a/src/core/hle/kernel/k_server_port.cpp +++ b/src/core/hle/kernel/k_server_port.cpp @@ -27,12 +27,14 @@ bool KServerPort::IsLight() const { void KServerPort::CleanupSessions() { // Ensure our preconditions are met. if (this->IsLight()) { - UNIMPLEMENTED(); + ASSERT(m_session_list.empty()); + } else { + ASSERT(m_light_session_list.empty()); } // Cleanup the session list. while (true) { - // Get the last session in the list + // Get the last session in the list. KServerSession* session = nullptr; { KScopedSchedulerLock sl{m_kernel}; @@ -49,6 +51,26 @@ void KServerPort::CleanupSessions() { break; } } + + // Cleanup the light session list. + while (true) { + // Get the last session in the list. + KLightServerSession* session = nullptr; + { + KScopedSchedulerLock sl{m_kernel}; + if (!m_light_session_list.empty()) { + session = std::addressof(m_light_session_list.front()); + m_light_session_list.pop_front(); + } + } + + // Close the session. + if (session != nullptr) { + session->Close(); + } else { + break; + } + } } void KServerPort::Destroy() { @@ -64,8 +86,7 @@ void KServerPort::Destroy() { bool KServerPort::IsSignaled() const { if (this->IsLight()) { - UNIMPLEMENTED(); - return false; + return !m_light_session_list.empty(); } else { return !m_session_list.empty(); } @@ -83,6 +104,18 @@ void KServerPort::EnqueueSession(KServerSession* session) { } } +void KServerPort::EnqueueSession(KLightServerSession* session) { + ASSERT(this->IsLight()); + + KScopedSchedulerLock sl{m_kernel}; + + // Add the session to our queue. + m_light_session_list.push_back(*session); + if (m_light_session_list.size() == 1) { + this->NotifyAvailable(); + } +} + KServerSession* KServerPort::AcceptSession() { ASSERT(!this->IsLight()); @@ -98,4 +131,19 @@ KServerSession* KServerPort::AcceptSession() { return session; } +KLightServerSession* KServerPort::AcceptLightSession() { + ASSERT(this->IsLight()); + + KScopedSchedulerLock sl{m_kernel}; + + // Return the first session in the list. + if (m_light_session_list.empty()) { + return nullptr; + } + + KLightServerSession* session = std::addressof(m_light_session_list.front()); + m_light_session_list.pop_front(); + return session; +} + } // namespace Kernel |