dont escape from check_state() before ensuring signal is resetted.

This commit is contained in:
Eladash 2019-09-21 15:31:01 +03:00 committed by Ivan
parent 3121fecc8f
commit 399ea2edb2

View File

@ -229,11 +229,6 @@ bool cpu_thread::check_state() noexcept
return true;
}
if (state & cpu_flag::signal && state.test_and_reset(cpu_flag::signal))
{
cpu_sleep_called = false;
}
const auto [state0, escape] = state.fetch_op([&](bs_t<cpu_flag>& flags)
{
// Atomically clean wait flag and escape
@ -251,6 +246,11 @@ bool cpu_thread::check_state() noexcept
return true;
});
if (state & cpu_flag::signal && state.test_and_reset(cpu_flag::signal))
{
cpu_sleep_called = false;
}
if (escape)
{
if (cpu_flag_memory)