Commit 19c67ab7 authored by Max Kellermann's avatar Max Kellermann

Idle, GlobalEvents: use std::atomic::exchange()

Less overhead than fetch_and() for what we do.
parent a046b6e1
...@@ -59,7 +59,7 @@ GlobalEventCallback(G_GNUC_UNUSED GIOChannel *source, ...@@ -59,7 +59,7 @@ GlobalEventCallback(G_GNUC_UNUSED GIOChannel *source,
if (!GlobalEvents::wake_fd.Read()) if (!GlobalEvents::wake_fd.Read())
return true; return true;
const unsigned flags = GlobalEvents::flags.fetch_and(0); const unsigned flags = GlobalEvents::flags.exchange(0);
for (unsigned i = 0; i < GlobalEvents::MAX; ++i) for (unsigned i = 0; i < GlobalEvents::MAX; ++i)
if (flags & (1u << i)) if (flags & (1u << i))
......
...@@ -61,7 +61,7 @@ idle_add(unsigned flags) ...@@ -61,7 +61,7 @@ idle_add(unsigned flags)
unsigned unsigned
idle_get(void) idle_get(void)
{ {
return idle_flags.fetch_and(0); return idle_flags.exchange(0);
} }
const char*const* const char*const*
......
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