diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 166f8aeb00..432dd31cbe 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -2250,7 +2250,13 @@ std::string thread_ctrl::get_name_cached() if (!_this->m_tname.is_equal(name_cache)) [[unlikely]] { - name_cache = _this->m_tname.load(); + _this->m_tname.peek_op([&](const shared_ptr& ptr) + { + if (ptr != name_cache) + { + name_cache = ptr; + } + }); } return *name_cache; diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 1870afcd88..cec21f4fc8 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -1049,7 +1049,13 @@ void ppu_thread::fast_call(u32 addr, u32 rtoc) if (!_this->ppu_tname.is_equal(name_cache)) [[unlikely]] { - name_cache = _this->ppu_tname.load(); + _this->ppu_tname.peek_op([&](const shared_ptr& ptr) + { + if (ptr != name_cache) + { + name_cache = ptr; + } + }); } const auto cia = _this->cia; diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 8aa4da0bfd..37da1d2297 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1615,7 +1615,13 @@ void spu_thread::cpu_task() if (!cpu->spu_tname.is_equal(name_cache)) [[unlikely]] { - name_cache = cpu->spu_tname.load(); + cpu->spu_tname.peek_op([&](const shared_ptr& ptr) + { + if (ptr != name_cache) + { + name_cache = ptr; + } + }); } const auto type = cpu->get_type(); diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index c3a9bc06d1..2ec55d70be 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -205,6 +205,11 @@ namespace stx } } + operator element_type*() const noexcept + { + return m_ptr; + } + explicit constexpr operator bool() const noexcept { return m_ptr != nullptr; @@ -521,6 +526,11 @@ namespace stx } } + operator element_type*() const noexcept + { + return m_ptr; + } + explicit constexpr operator bool() const noexcept { return m_ptr != nullptr; @@ -731,11 +741,6 @@ namespace stx return r; } - operator shared_type() const noexcept - { - return load(); - } - // Atomically inspect pointer with the possibility to reference it if necessary template > RT peek_op(F op) const noexcept