From afbad3b3107fbf7da48fab7fc064096520514a87 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 2 Jul 2010 01:30:41 +0200 Subject: [PATCH] function to test whether events are pending --- core/AmEventQueue.cpp | 7 +++++++ core/AmEventQueue.h | 1 + 2 files changed, 8 insertions(+) diff --git a/core/AmEventQueue.cpp b/core/AmEventQueue.cpp index c6ae9d83..6cbc4903 100644 --- a/core/AmEventQueue.cpp +++ b/core/AmEventQueue.cpp @@ -124,6 +124,13 @@ void AmEventQueue::processSingleEvent() m_queue.unlock(); } +bool AmEventQueue::eventPending() { + m_queue.lock(); + bool res = !ev_queue.empty(); + m_queue.unlock(); + return res; +} + void AmEventQueue::setEventNotificationSink(AmEventNotificationSink* _wakeup_handler) { // locking actually not necessary - if replacing pointer is atomic diff --git a/core/AmEventQueue.h b/core/AmEventQueue.h index e6322ea2..37dbb9ae 100644 --- a/core/AmEventQueue.h +++ b/core/AmEventQueue.h @@ -76,6 +76,7 @@ public: void waitForEvent(); void wakeup(); void processSingleEvent(); + bool eventPending(); void setEventNotificationSink(AmEventNotificationSink* _wakeup_handler); };