Commit 0c74060c authored by Xavier Thompson's avatar Xavier Thompson

event_count.hpp: Fix no waiter optimisation

parent b5e5bdab
...@@ -47,15 +47,19 @@ namespace typon::fdt::lock_free ...@@ -47,15 +47,19 @@ namespace typon::fdt::lock_free
void notify_one() noexcept void notify_one() noexcept
{ {
_state.fetch_add(shift, std::memory_order_acq_rel); if (_state.fetch_add(shift, std::memory_order_acq_rel) & mask)
{
_state.notify_one(); _state.notify_one();
} }
}
void notify_all() noexcept void notify_all() noexcept
{ {
_state.fetch_add(shift, std::memory_order_acq_rel); if (_state.fetch_add(shift, std::memory_order_acq_rel) & mask)
{
_state.notify_all(); _state.notify_all();
} }
}
}; };
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment