From 19c67ab72457d68fa35bdad8b4c5ed5ecf04816e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 27 Feb 2013 20:35:44 +0100 Subject: Idle, GlobalEvents: use std::atomic::exchange() Less overhead than fetch_and() for what we do. --- src/GlobalEvents.cxx | 2 +- src/Idle.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GlobalEvents.cxx b/src/GlobalEvents.cxx index e4f335c9..7c4ffdc1 100644 --- a/src/GlobalEvents.cxx +++ b/src/GlobalEvents.cxx @@ -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)) diff --git a/src/Idle.cxx b/src/Idle.cxx index fefbd2fe..840a5d4e 100644 --- a/src/Idle.cxx +++ b/src/Idle.cxx @@ -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* -- cgit v1.2.3