summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2021-05-01 12:38:23 -0700
committerGravatar bunnei2021-05-05 16:40:53 -0700
commit4356361faf9b3fb87d55535e2e8300a8a4134a1d (patch)
treee849c36bf5f714833f5ac248c60c7e1afb6978b8 /src/core/hle/kernel
parentfixup! hle: kernel: Add initial impl. of KAutoObjectWithListContainer. (diff)
downloadyuzu-4356361faf9b3fb87d55535e2e8300a8a4134a1d.tar.gz
yuzu-4356361faf9b3fb87d55535e2e8300a8a4134a1d.tar.xz
yuzu-4356361faf9b3fb87d55535e2e8300a8a4134a1d.zip
fixup! hle: kernel: Add initial impl. of KAutoObjectWithListContainer.
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/k_auto_object_container.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h
index 8609f7a8d..ff40cf5a7 100644
--- a/src/core/hle/kernel/k_auto_object_container.h
+++ b/src/core/hle/kernel/k_auto_object_container.h
@@ -28,16 +28,11 @@ public:
28 28
29public: 29public:
30 class ListAccessor : public KScopedLightLock { 30 class ListAccessor : public KScopedLightLock {
31 private:
32 ListType& m_list;
33
34 public: 31 public:
35 explicit ListAccessor(KAutoObjectWithListContainer* container) 32 explicit ListAccessor(KAutoObjectWithListContainer* container)
36 : KScopedLightLock(container->m_lock), m_list(container->m_object_list) { /* ... */ 33 : KScopedLightLock(container->m_lock), m_list(container->m_object_list) {}
37 }
38 explicit ListAccessor(KAutoObjectWithListContainer& container) 34 explicit ListAccessor(KAutoObjectWithListContainer& container)
39 : KScopedLightLock(container.m_lock), m_list(container.m_object_list) { /* ... */ 35 : KScopedLightLock(container.m_lock), m_list(container.m_object_list) {}
40 }
41 36
42 typename ListType::iterator begin() const { 37 typename ListType::iterator begin() const {
43 return m_list.begin(); 38 return m_list.begin();
@@ -50,14 +45,13 @@ public:
50 typename ListType::iterator find(typename ListType::const_reference ref) const { 45 typename ListType::iterator find(typename ListType::const_reference ref) const {
51 return m_list.find(ref); 46 return m_list.find(ref);
52 } 47 }
48
49 private:
50 ListType& m_list;
53 }; 51 };
54 52
55 friend class ListAccessor; 53 friend class ListAccessor;
56 54
57private:
58 KLightLock m_lock;
59 ListType m_object_list;
60
61public: 55public:
62 KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {} 56 KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {}
63 57
@@ -67,6 +61,10 @@ public:
67 void Register(KAutoObjectWithList* obj); 61 void Register(KAutoObjectWithList* obj);
68 void Unregister(KAutoObjectWithList* obj); 62 void Unregister(KAutoObjectWithList* obj);
69 size_t GetOwnedCount(KProcess* owner); 63 size_t GetOwnedCount(KProcess* owner);
64
65private:
66 KLightLock m_lock;
67 ListType m_object_list;
70}; 68};
71 69
72} // namespace Kernel 70} // namespace Kernel