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

Less overhead than fetch_and() for what we do.
This commit is contained in:
Max Kellermann 2013-02-27 20:35:44 +01:00
parent a046b6e105
commit 19c67ab724
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ GlobalEventCallback(G_GNUC_UNUSED GIOChannel *source,
if (!GlobalEvents::wake_fd.Read())
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)
if (flags & (1u << i))

View File

@ -61,7 +61,7 @@ idle_add(unsigned flags)
unsigned
idle_get(void)
{
return idle_flags.fetch_and(0);
return idle_flags.exchange(0);
}
const char*const*