From 92be0a347cdfd9c407611982c72938ecde777a8c Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 25 May 2009 18:20:50 +0000 Subject: PollableQueue optimization - replace deque with vector. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@778464 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/QueueEvents.cpp | 13 ++++++------- cpp/src/qpid/broker/QueueEvents.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'cpp/src/qpid/broker') diff --git a/cpp/src/qpid/broker/QueueEvents.cpp b/cpp/src/qpid/broker/QueueEvents.cpp index 7525e4cb76..c501a0ffbc 100644 --- a/cpp/src/qpid/broker/QueueEvents.cpp +++ b/cpp/src/qpid/broker/QueueEvents.cpp @@ -66,15 +66,14 @@ void QueueEvents::unregisterListener(const std::string& id) } } -void QueueEvents::handle(EventQueue::Queue& events) -{ +QueueEvents::EventQueue::Batch::const_iterator +QueueEvents::handle(const EventQueue::Batch& events) { qpid::sys::Mutex::ScopedLock l(lock); - while (!events.empty()) { - for (Listeners::iterator i = listeners.begin(); i != listeners.end(); i++) { - i->second(events.front()); - } - events.pop_front(); + for (EventQueue::Batch::const_iterator i = events.begin(); i != events.end(); ++i) { + for (Listeners::iterator j = listeners.begin(); j != listeners.end(); j++) + j->second(*i); } + return events.end(); } void QueueEvents::shutdown() diff --git a/cpp/src/qpid/broker/QueueEvents.h b/cpp/src/qpid/broker/QueueEvents.h index 82abd3d20a..a3d4ea42f9 100644 --- a/cpp/src/qpid/broker/QueueEvents.h +++ b/cpp/src/qpid/broker/QueueEvents.h @@ -74,7 +74,7 @@ class QueueEvents volatile bool enabled; qpid::sys::Mutex lock;//protect listeners from concurrent access - void handle(EventQueue::Queue& e); + EventQueue::Batch::const_iterator handle(const EventQueue::Batch& e); }; }} // namespace qpid::broker -- cgit v1.2.1