Try to purge thread_state::detached

It's rarely necessary, but can cause unexpected problems.
This commit is contained in:
Nekotekina 2020-02-28 20:45:27 +03:00
parent cb047fcc75
commit 490f58ff3c
5 changed files with 31 additions and 31 deletions

View file

@ -1858,11 +1858,13 @@ bool thread_base::finalize(int) noexcept
fsoft, fhard, ctxvol, ctxinv);
// Return true if need to delete thread object
const bool result = m_state.exchange(thread_state::finished) == thread_state::detached;
const bool ok = m_state.exchange(thread_state::finished) <= thread_state::aborting;
// Signal waiting threads
m_state.notify_all();
return result;
// No detached thread supported atm
return !ok;
}
void thread_base::finalize() noexcept