summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-16 23:24:58 +0100
committerMax Kellermann <max@duempel.org>2013-01-16 23:27:17 +0100
commit2bb01093c0898d2605ba7df0b2cba6e8541a8509 (patch)
treeff05162e549fa6d26977bfbd6088144f1c69fb0b
parent36c814d26e2ef2b689e706b3e8db4777df4e2442 (diff)
Idle: don't wake up event loop on duplicate event
-rw-r--r--src/Idle.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Idle.cxx b/src/Idle.cxx
index f1423ebeb..fefbd2fe9 100644
--- a/src/Idle.cxx
+++ b/src/Idle.cxx
@@ -52,9 +52,10 @@ idle_add(unsigned flags)
{
assert(flags != 0);
- idle_flags |= flags;
+ unsigned old_flags = idle_flags.fetch_or(flags);
- GlobalEvents::Emit(GlobalEvents::IDLE);
+ if ((old_flags & flags) != flags)
+ GlobalEvents::Emit(GlobalEvents::IDLE);
}
unsigned