mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
Try to purge thread_state::detached
It's rarely necessary, but can cause unexpected problems.
This commit is contained in:
parent
cb047fcc75
commit
490f58ff3c
5 changed files with 31 additions and 31 deletions
|
|
@ -424,12 +424,6 @@ extern bool ppu_patch(u32 addr, u32 value)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ppu_thread::on_cleanup(named_thread<ppu_thread>* _this)
|
||||
{
|
||||
// Remove thread id
|
||||
idm::remove<named_thread<ppu_thread>>(_this->id);
|
||||
}
|
||||
|
||||
std::string ppu_thread::dump() const
|
||||
{
|
||||
std::string ret = cpu_thread::dump();
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ public:
|
|||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 2048;
|
||||
|
||||
static void on_cleanup(named_thread<ppu_thread>*);
|
||||
|
||||
virtual std::string dump() const override;
|
||||
virtual void cpu_task() override final;
|
||||
virtual void cpu_sleep() override;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,26 @@ void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode)
|
|||
if (jid == umax)
|
||||
{
|
||||
// Detach detached thread, id will be removed on cleanup
|
||||
static_cast<named_thread<ppu_thread>&>(ppu) = thread_state::detached;
|
||||
static thread_local struct cleanup_t
|
||||
{
|
||||
const u32 id;
|
||||
|
||||
cleanup_t(u32 id)
|
||||
: id(id)
|
||||
{
|
||||
}
|
||||
|
||||
cleanup_t(const cleanup_t&) = delete;
|
||||
|
||||
~cleanup_t()
|
||||
{
|
||||
if (!idm::remove<named_thread<ppu_thread>>(id))
|
||||
{
|
||||
sys_ppu_thread.fatal("Failed to remove detached thread! (id=0x%x)", id);
|
||||
}
|
||||
}
|
||||
}
|
||||
to_cleanup(ppu.id);
|
||||
}
|
||||
else if (jid != 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue