summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Liam2023-12-23 16:26:07 -0500
committerGravatar Liam2023-12-23 16:26:07 -0500
commite3491a9ee862e5980c623d4a85cd3dd07e355e59 (patch)
treed1dd67286d63ffa32041a2db223136ac35113ca3
parentMerge pull request #12412 from ameerj/gl-query-prims (diff)
downloadyuzu-e3491a9ee862e5980c623d4a85cd3dd07e355e59.tar.gz
yuzu-e3491a9ee862e5980c623d4a85cd3dd07e355e59.tar.xz
yuzu-e3491a9ee862e5980c623d4a85cd3dd07e355e59.zip
kernel: use simple mutex for object list container
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_auto_object_container.cpp9
-rw-r--r--src/core/hle/kernel/k_auto_object_container.h31
-rw-r--r--src/core/hle/kernel/k_transfer_memory.h1
3 files changed, 10 insertions, 31 deletions
diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp
index 636b3f993..7bea1a1c2 100644
--- a/src/core/hle/kernel/k_auto_object_container.cpp
+++ b/src/core/hle/kernel/k_auto_object_container.cpp
@@ -8,19 +8,22 @@
8namespace Kernel { 8namespace Kernel {
9 9
10void KAutoObjectWithListContainer::Register(KAutoObjectWithList* obj) { 10void KAutoObjectWithListContainer::Register(KAutoObjectWithList* obj) {
11 KScopedLightLock lk(m_lock); 11 // KScopedInterruptDisable di;
12 KScopedSpinLock lk(m_lock);
12 13
13 m_object_list.insert_unique(*obj); 14 m_object_list.insert_unique(*obj);
14} 15}
15 16
16void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) { 17void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) {
17 KScopedLightLock lk(m_lock); 18 // KScopedInterruptDisable di;
19 KScopedSpinLock lk(m_lock);
18 20
19 m_object_list.erase(*obj); 21 m_object_list.erase(*obj);
20} 22}
21 23
22size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) { 24size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {
23 KScopedLightLock lk(m_lock); 25 // KScopedInterruptDisable di;
26 KScopedSpinLock lk(m_lock);
24 27
25 return std::count_if(m_object_list.begin(), m_object_list.end(), 28 return std::count_if(m_object_list.begin(), m_object_list.end(),
26 [&](const auto& obj) { return obj.GetOwner() == owner; }); 29 [&](const auto& obj) { return obj.GetOwner() == owner; });
diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h
index badd75d2a..770743d21 100644
--- a/src/core/hle/kernel/k_auto_object_container.h
+++ b/src/core/hle/kernel/k_auto_object_container.h
@@ -7,7 +7,7 @@
7 7
8#include "common/common_funcs.h" 8#include "common/common_funcs.h"
9#include "core/hle/kernel/k_auto_object.h" 9#include "core/hle/kernel/k_auto_object.h"
10#include "core/hle/kernel/k_light_lock.h" 10#include "core/hle/kernel/k_spin_lock.h"
11 11
12namespace Kernel { 12namespace Kernel {
13 13
@@ -21,32 +21,7 @@ public:
21 21
22 using ListType = boost::intrusive::rbtree<KAutoObjectWithList>; 22 using ListType = boost::intrusive::rbtree<KAutoObjectWithList>;
23 23
24 class ListAccessor : public KScopedLightLock { 24 KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(), m_object_list() {}
25 public:
26 explicit ListAccessor(KAutoObjectWithListContainer* container)
27 : KScopedLightLock(container->m_lock), m_list(container->m_object_list) {}
28 explicit ListAccessor(KAutoObjectWithListContainer& container)
29 : KScopedLightLock(container.m_lock), m_list(container.m_object_list) {}
30
31 typename ListType::iterator begin() const {
32 return m_list.begin();
33 }
34
35 typename ListType::iterator end() const {
36 return m_list.end();
37 }
38
39 typename ListType::iterator find(typename ListType::const_reference ref) const {
40 return m_list.find(ref);
41 }
42
43 private:
44 ListType& m_list;
45 };
46
47 friend class ListAccessor;
48
49 KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {}
50 25
51 void Initialize() {} 26 void Initialize() {}
52 void Finalize() {} 27 void Finalize() {}
@@ -56,7 +31,7 @@ public:
56 size_t GetOwnedCount(KProcess* owner); 31 size_t GetOwnedCount(KProcess* owner);
57 32
58private: 33private:
59 KLightLock m_lock; 34 KSpinLock m_lock;
60 ListType m_object_list; 35 ListType m_object_list;
61}; 36};
62 37
diff --git a/src/core/hle/kernel/k_transfer_memory.h b/src/core/hle/kernel/k_transfer_memory.h
index 8a0b08761..530b45218 100644
--- a/src/core/hle/kernel/k_transfer_memory.h
+++ b/src/core/hle/kernel/k_transfer_memory.h
@@ -5,6 +5,7 @@
5 5
6#include <optional> 6#include <optional>
7 7
8#include "core/hle/kernel/k_light_lock.h"
8#include "core/hle/kernel/k_page_group.h" 9#include "core/hle/kernel/k_page_group.h"
9#include "core/hle/kernel/slab_helpers.h" 10#include "core/hle/kernel/slab_helpers.h"
10#include "core/hle/kernel/svc_types.h" 11#include "core/hle/kernel/svc_types.h"