mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-05 15:40:10 +00:00
Fix sys_config_unregister_service
This commit is contained in:
parent
c9d39ce7ae
commit
036693a14d
@ -133,6 +133,23 @@ lv2_config_service_event& lv2_config_service_event::operator=(thread_state s) no
|
||||
return *this;
|
||||
}
|
||||
|
||||
lv2_config_service_event::~lv2_config_service_event() noexcept
|
||||
{
|
||||
operator=(thread_state::destroying_context);
|
||||
}
|
||||
|
||||
lv2_config::~lv2_config() noexcept
|
||||
{
|
||||
for (auto& [key, event] : events)
|
||||
{
|
||||
if (event)
|
||||
{
|
||||
// Avoid collision with lv2_config_service_event destructor
|
||||
event->m_destroyed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LV2 Config Service Listener
|
||||
bool lv2_config_service_listener::check_service(const lv2_config_service& service) const
|
||||
{
|
||||
|
@ -161,6 +161,8 @@ public:
|
||||
|
||||
return null_ptr;
|
||||
}
|
||||
|
||||
~lv2_config() noexcept;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -276,7 +278,7 @@ public:
|
||||
|
||||
// Utilities
|
||||
usz get_size() const { return sizeof(sys_config_service_event_t)-1 + data.size(); }
|
||||
shared_ptr<lv2_config_service> get_shared_ptr () const { return idm::get_unlocked<lv2_config_service>(idm_id); }
|
||||
shared_ptr<lv2_config_service> get_shared_ptr () const { return stx::make_shared_from_this<lv2_config_service>(this); }
|
||||
u32 get_id() const { return idm_id; }
|
||||
};
|
||||
|
||||
@ -342,7 +344,7 @@ public:
|
||||
|
||||
// Utilities
|
||||
u32 get_id() const { return idm_id; }
|
||||
shared_ptr<lv2_config_service_listener> get_shared_ptr() const { return idm::get_unlocked<lv2_config_service_listener>(idm_id); }
|
||||
shared_ptr<lv2_config_service_listener> get_shared_ptr() const { return stx::make_shared_from_this<lv2_config_service_listener>(this); }
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -361,13 +361,8 @@ namespace stx
|
||||
[[deprecated("Use null_ptr")]] shared_ptr(std::nullptr_t) = delete;
|
||||
|
||||
// Not-so-aliasing constructor: emulates std::enable_shared_from_this without its overhead
|
||||
explicit shared_ptr(T* _this) noexcept
|
||||
: m_ptr(_this)
|
||||
{
|
||||
// Random checks which may fail on invalid pointer
|
||||
ensure((reinterpret_cast<u64>(d()->destroy) - 0x10000) >> 47 == 0);
|
||||
ensure((d()->refs++ - 1) >> 58 == 0);
|
||||
}
|
||||
template <typename Type>
|
||||
friend shared_ptr<Type> make_shared_from_this(const Type* _this) noexcept;
|
||||
|
||||
template <typename U> requires same_ptr_implicit_v<T, U>
|
||||
shared_ptr(const shared_ptr<U>& r) noexcept
|
||||
@ -562,11 +557,29 @@ namespace stx
|
||||
|
||||
template <typename T>
|
||||
requires (std::is_constructible_v<std::remove_reference_t<T>, T&&>)
|
||||
static shared_ptr<std::remove_reference_t<T>> make_shared_value(T&& value)
|
||||
static shared_ptr<std::remove_reference_t<T>> make_shared_value(T&& value) noexcept
|
||||
{
|
||||
return make_single_value(std::forward<T>(value));
|
||||
}
|
||||
|
||||
// Not-so-aliasing constructor: emulates std::enable_shared_from_this without its overhead
|
||||
template <typename T>
|
||||
static shared_ptr<T> make_shared_from_this(const T* _this) noexcept
|
||||
{
|
||||
shared_ptr<T> r;
|
||||
r.m_ptr = const_cast<T*>(_this);
|
||||
|
||||
if (!_this) [[unlikely]]
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
// Random checks which may fail on invalid pointer
|
||||
ensure((reinterpret_cast<u64>(r.d()->destroy.load()) - 0x10000) >> 47 == 0);
|
||||
ensure((r.d()->refs++ - 1) >> 58 == 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
// Atomic simplified shared pointer
|
||||
template <typename T>
|
||||
class atomic_ptr
|
||||
@ -1059,9 +1072,9 @@ namespace stx
|
||||
do
|
||||
{
|
||||
// Update old head with current value
|
||||
next.m_ptr = reinterpret_cast<T*>(old.m_val.raw() >> c_ref_size);
|
||||
next.m_ptr = std::launder(ptr_to(old.m_val.raw()));
|
||||
|
||||
} while (!m_val.compare_exchange(old.m_val.raw(), reinterpret_cast<uptr>(exch.m_ptr) << c_ref_size));
|
||||
} while (!m_val.compare_exchange(old.m_val.raw(), to_val(exch.m_ptr)));
|
||||
|
||||
// This argument is consumed (moved from)
|
||||
exch.m_ptr = nullptr;
|
||||
@ -1076,7 +1089,7 @@ namespace stx
|
||||
// Simple atomic load is much more effective than load(), but it's a non-owning reference
|
||||
T* observe() const noexcept
|
||||
{
|
||||
return reinterpret_cast<T*>(m_val >> c_ref_size);
|
||||
return std::launder(ptr_to(m_val));
|
||||
}
|
||||
|
||||
explicit constexpr operator bool() const noexcept
|
||||
@ -1138,11 +1151,6 @@ namespace stx
|
||||
return false;
|
||||
}
|
||||
|
||||
constexpr std::nullptr_t get() const noexcept
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} null_ptr;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user