diff options
| author | 2023-12-26 11:46:19 -0500 | |
|---|---|---|
| committer | 2023-12-26 11:46:19 -0500 | |
| commit | 12178c694ab20898c2d007e0efb30a28d1aee100 (patch) | |
| tree | dce17c0a46c0d0052129c73ae139cf12ce1376d6 | |
| parent | Merge pull request #12465 from liamwhite/proper-handle-table (diff) | |
| parent | kernel: use simple mutex for object list container (diff) | |
| download | yuzu-12178c694ab20898c2d007e0efb30a28d1aee100.tar.gz yuzu-12178c694ab20898c2d007e0efb30a28d1aee100.tar.xz yuzu-12178c694ab20898c2d007e0efb30a28d1aee100.zip | |
Merge pull request #12455 from liamwhite/end-wait
kernel: use simple mutex for object list container
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/k_auto_object_container.cpp | 9 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_auto_object_container.h | 31 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_transfer_memory.h | 1 |
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 @@ | |||
| 8 | namespace Kernel { | 8 | namespace Kernel { |
| 9 | 9 | ||
| 10 | void KAutoObjectWithListContainer::Register(KAutoObjectWithList* obj) { | 10 | void 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 | ||
| 16 | void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) { | 17 | void 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 | ||
| 22 | size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) { | 24 | size_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 | ||
| 12 | namespace Kernel { | 12 | namespace 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 | ||
| 58 | private: | 33 | private: |
| 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" |