mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
Threads: fix minor race
Has already been in "fixed" state in past...
This commit is contained in:
parent
b5d498ffda
commit
22a24446c1
@ -2010,7 +2010,10 @@ u64 thread_base::finalize(thread_state result_state) noexcept
|
|||||||
|
|
||||||
atomic_wait_engine::set_wait_callback(nullptr);
|
atomic_wait_engine::set_wait_callback(nullptr);
|
||||||
|
|
||||||
// Return true if need to delete thread object (no)
|
// Avoid race with the destructor
|
||||||
|
const u64 _self = m_thread;
|
||||||
|
|
||||||
|
// Set result state (errored or finalized)
|
||||||
const bool ok = 0 == (3 & ~m_sync.fetch_op([&](u64& v)
|
const bool ok = 0 == (3 & ~m_sync.fetch_op([&](u64& v)
|
||||||
{
|
{
|
||||||
v &= -4;
|
v &= -4;
|
||||||
@ -2020,8 +2023,7 @@ u64 thread_base::finalize(thread_state result_state) noexcept
|
|||||||
// Signal waiting threads
|
// Signal waiting threads
|
||||||
m_sync.notify_all(2);
|
m_sync.notify_all(2);
|
||||||
|
|
||||||
// No detached thread supported atm
|
return _self;
|
||||||
return m_thread;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_base::native_entry thread_base::finalize(u64 _self) noexcept
|
thread_base::native_entry thread_base::finalize(u64 _self) noexcept
|
||||||
|
Loading…
Reference in New Issue
Block a user