summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-06-07 00:39:11 +0200
committerbunnei <bunneidev@gmail.com>2021-06-07 00:39:11 +0200
commit611983679593d8a666551254bc97490effbb6519 (patch)
tree19e9f1fe9664a6b6558258c1c58a30d803e30d93
parenthle: kernel: Refactor to allocate a ServiceThread per service handler. (diff)
downloadyuzu-611983679593d8a666551254bc97490effbb6519.tar
yuzu-611983679593d8a666551254bc97490effbb6519.tar.gz
yuzu-611983679593d8a666551254bc97490effbb6519.tar.bz2
yuzu-611983679593d8a666551254bc97490effbb6519.tar.lz
yuzu-611983679593d8a666551254bc97490effbb6519.tar.xz
yuzu-611983679593d8a666551254bc97490effbb6519.tar.zst
yuzu-611983679593d8a666551254bc97490effbb6519.zip
-rw-r--r--src/core/hle/kernel/k_auto_object.h11
-rw-r--r--src/core/hle/kernel/k_auto_object_container.cpp4
-rw-r--r--src/core/hle/kernel/k_auto_object_container.h5
-rw-r--r--src/core/hle/kernel/k_client_port.cpp4
-rw-r--r--src/core/hle/kernel/k_client_session.h4
-rw-r--r--src/core/hle/kernel/k_readable_event.h4
-rw-r--r--src/core/hle/kernel/k_server_port.cpp4
-rw-r--r--src/core/hle/kernel/k_server_port.h2
-rw-r--r--src/core/hle/kernel/k_server_session.cpp4
-rw-r--r--src/core/hle/kernel/k_server_session.h2
-rw-r--r--src/core/hle/kernel/k_writable_event.cpp4
11 files changed, 26 insertions, 22 deletions
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h
index bc18582be..88a052f65 100644
--- a/src/core/hle/kernel/k_auto_object.h
+++ b/src/core/hle/kernel/k_auto_object.h
@@ -7,10 +7,11 @@
#include <atomic>
#include <string>
+#include <boost/intrusive/rbtree.hpp>
+
#include "common/assert.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
-#include "common/intrusive_red_black_tree.h"
#include "core/hle/kernel/k_class_token.h"
namespace Kernel {
@@ -175,7 +176,7 @@ private:
class KAutoObjectWithListContainer;
-class KAutoObjectWithList : public KAutoObject {
+class KAutoObjectWithList : public KAutoObject, public boost::intrusive::set_base_hook<> {
public:
explicit KAutoObjectWithList(KernelCore& kernel_) : KAutoObject(kernel_) {}
@@ -192,6 +193,10 @@ public:
}
}
+ friend bool operator<(const KAutoObjectWithList& left, const KAutoObjectWithList& right) {
+ return &left < &right;
+ }
+
public:
virtual u64 GetId() const {
return reinterpret_cast<u64>(this);
@@ -203,8 +208,6 @@ public:
private:
friend class KAutoObjectWithListContainer;
-
- Common::IntrusiveRedBlackTreeNode list_node;
};
template <typename T>
diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp
index fc0c28874..010006bb7 100644
--- a/src/core/hle/kernel/k_auto_object_container.cpp
+++ b/src/core/hle/kernel/k_auto_object_container.cpp
@@ -9,13 +9,13 @@ namespace Kernel {
void KAutoObjectWithListContainer::Register(KAutoObjectWithList* obj) {
KScopedLightLock lk(m_lock);
- m_object_list.insert(*obj);
+ m_object_list.insert_unique(*obj);
}
void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) {
KScopedLightLock lk(m_lock);
- m_object_list.erase(m_object_list.iterator_to(*obj));
+ m_object_list.erase(*obj);
}
size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {
diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h
index ff40cf5a7..459953450 100644
--- a/src/core/hle/kernel/k_auto_object_container.h
+++ b/src/core/hle/kernel/k_auto_object_container.h
@@ -6,6 +6,8 @@
#include <atomic>
+#include <boost/intrusive/rbtree.hpp>
+
#include "common/assert.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -23,8 +25,7 @@ class KAutoObjectWithListContainer {
YUZU_NON_MOVEABLE(KAutoObjectWithListContainer);
public:
- using ListType = Common::IntrusiveRedBlackTreeMemberTraits<
- &KAutoObjectWithList::list_node>::TreeType<KAutoObjectWithList>;
+ using ListType = boost::intrusive::rbtree<KAutoObjectWithList>;
public:
class ListAccessor : public KScopedLightLock {
diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp
index d4a38fb00..50606bd91 100644
--- a/src/core/hle/kernel/k_client_port.cpp
+++ b/src/core/hle/kernel/k_client_port.cpp
@@ -16,11 +16,11 @@ namespace Kernel {
KClientPort::KClientPort(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
KClientPort::~KClientPort() = default;
-void KClientPort::Initialize(KPort* parent_, s32 max_sessions_, std::string&& name_) {
+void KClientPort::Initialize(KPort* parent_port_, s32 max_sessions_, std::string&& name_) {
// Set member variables.
num_sessions = 0;
peak_sessions = 0;
- parent = parent_;
+ parent = parent_port_;
max_sessions = max_sessions_;
name = std::move(name_);
}
diff --git a/src/core/hle/kernel/k_client_session.h b/src/core/hle/kernel/k_client_session.h
index b11d5b4e3..230e3b6b8 100644
--- a/src/core/hle/kernel/k_client_session.h
+++ b/src/core/hle/kernel/k_client_session.h
@@ -36,9 +36,9 @@ public:
explicit KClientSession(KernelCore& kernel_);
~KClientSession() override;
- void Initialize(KSession* parent_, std::string&& name_) {
+ void Initialize(KSession* parent_session_, std::string&& name_) {
// Set member variables.
- parent = parent_;
+ parent = parent_session_;
name = std::move(name_);
}
diff --git a/src/core/hle/kernel/k_readable_event.h b/src/core/hle/kernel/k_readable_event.h
index b2850ac7b..149fa78dd 100644
--- a/src/core/hle/kernel/k_readable_event.h
+++ b/src/core/hle/kernel/k_readable_event.h
@@ -21,9 +21,9 @@ public:
explicit KReadableEvent(KernelCore& kernel_);
~KReadableEvent() override;
- void Initialize(KEvent* parent_, std::string&& name_) {
+ void Initialize(KEvent* parent_event_, std::string&& name_) {
is_signaled = false;
- parent = parent_;
+ parent = parent_event_;
name = std::move(name_);
}
diff --git a/src/core/hle/kernel/k_server_port.cpp b/src/core/hle/kernel/k_server_port.cpp
index 8cbde177a..c5dc58387 100644
--- a/src/core/hle/kernel/k_server_port.cpp
+++ b/src/core/hle/kernel/k_server_port.cpp
@@ -17,9 +17,9 @@ namespace Kernel {
KServerPort::KServerPort(KernelCore& kernel_) : KSynchronizationObject{kernel_} {}
KServerPort::~KServerPort() = default;
-void KServerPort::Initialize(KPort* parent_, std::string&& name_) {
+void KServerPort::Initialize(KPort* parent_port_, std::string&& name_) {
// Set member variables.
- parent = parent_;
+ parent = parent_port_;
name = std::move(name_);
}
diff --git a/src/core/hle/kernel/k_server_port.h b/src/core/hle/kernel/k_server_port.h
index 55481d63f..67a36da40 100644
--- a/src/core/hle/kernel/k_server_port.h
+++ b/src/core/hle/kernel/k_server_port.h
@@ -29,7 +29,7 @@ public:
explicit KServerPort(KernelCore& kernel_);
~KServerPort() override;
- void Initialize(KPort* parent_, std::string&& name_);
+ void Initialize(KPort* parent_port_, std::string&& name_);
/// Whether or not this server port has an HLE handler available.
bool HasSessionRequestHandler() const {
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp
index e66a9198a..3024395dd 100644
--- a/src/core/hle/kernel/k_server_session.cpp
+++ b/src/core/hle/kernel/k_server_session.cpp
@@ -29,10 +29,10 @@ KServerSession::KServerSession(KernelCore& kernel_) : KSynchronizationObject{ker
KServerSession::~KServerSession() {}
-void KServerSession::Initialize(KSession* parent_, std::string&& name_,
+void KServerSession::Initialize(KSession* parent_session_, std::string&& name_,
std::shared_ptr<SessionRequestManager> manager_) {
// Set member variables.
- parent = parent_;
+ parent = parent_session_;
name = std::move(name_);
if (manager_) {
diff --git a/src/core/hle/kernel/k_server_session.h b/src/core/hle/kernel/k_server_session.h
index 0f4b51e37..9efd400bc 100644
--- a/src/core/hle/kernel/k_server_session.h
+++ b/src/core/hle/kernel/k_server_session.h
@@ -47,7 +47,7 @@ public:
void Destroy() override;
- void Initialize(KSession* parent_, std::string&& name_,
+ void Initialize(KSession* parent_session_, std::string&& name_,
std::shared_ptr<SessionRequestManager> manager_);
KSession* GetParent() {
diff --git a/src/core/hle/kernel/k_writable_event.cpp b/src/core/hle/kernel/k_writable_event.cpp
index b7b83c151..bdb1db6d5 100644
--- a/src/core/hle/kernel/k_writable_event.cpp
+++ b/src/core/hle/kernel/k_writable_event.cpp
@@ -13,8 +13,8 @@ KWritableEvent::KWritableEvent(KernelCore& kernel_)
KWritableEvent::~KWritableEvent() = default;
-void KWritableEvent::Initialize(KEvent* parent_, std::string&& name_) {
- parent = parent_;
+void KWritableEvent::Initialize(KEvent* parent_event_, std::string&& name_) {
+ parent = parent_event_;
name = std::move(name_);
parent->GetReadableEvent().Open();
}