summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-08-20 14:45:19 +0000
committerGordon Sim <gsim@apache.org>2008-08-20 14:45:19 +0000
commit9a88d24b1a1e9391a224544aa406461071f6dcb3 (patch)
treeb2a7cb98d882e962e5074459bf34fcbc0260e96f
parentf3ee37b2d37cd22b1499583fdc57b2e88f02a11b (diff)
downloadqpid-python-9a88d24b1a1e9391a224544aa406461071f6dcb3.tar.gz
Remove 'clever' locking as it actually degrades performance.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@687361 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/src/qpid/broker/Queue.cpp29
-rw-r--r--cpp/src/qpid/broker/Queue.h12
2 files changed, 1 insertions, 40 deletions
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp
index acab1e06f1..40dfb80da2 100644
--- a/cpp/src/qpid/broker/Queue.cpp
+++ b/cpp/src/qpid/broker/Queue.cpp
@@ -307,18 +307,12 @@ void Queue::notify()
Listeners copy(listeners);
listeners.clear();
-
- sys::ScopedLock<Guard> g(notifierLock);//prevent consumers being deleted while held in copy
- {
- Mutex::ScopedUnlock u(messageLock);
- for_each(copy.begin(), copy.end(), mem_fun(&Consumer::notify));
- }
+ for_each(copy.begin(), copy.end(), mem_fun(&Consumer::notify));
}
void Queue::removeListener(Consumer& c)
{
Mutex::ScopedLock locker(messageLock);
- notifierLock.wait(messageLock);//wait until no notifies are in progress
Listeners::iterator i = std::find(listeners.begin(), listeners.end(), &c);
if (i != listeners.end()) listeners.erase(i);
}
@@ -722,27 +716,6 @@ void Queue::setExternalQueueStore(ExternalQueueStore* inst) {
}
}
-/*
- * Use of Guard requires an external lock to be held before calling
- * any of its methods
- */
-Queue::Guard::Guard() : count(0) {}
-
-void Queue::Guard::lock()
-{
- count++;
-}
-
-void Queue::Guard::unlock()
-{
- if (--count == 0) condition.notifyAll();
-}
-
-void Queue::Guard::wait(sys::Mutex& m)
-{
- while (count) condition.wait(m);
-}
-
ManagementObject* Queue::GetManagementObject (void) const
{
return (ManagementObject*) mgmtObject;
diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h
index 347fc5cf9d..8b8ba8278f 100644
--- a/cpp/src/qpid/broker/Queue.h
+++ b/cpp/src/qpid/broker/Queue.h
@@ -63,17 +63,6 @@ namespace qpid {
typedef qpid::InlineVector<Consumer*, 5> Listeners;
typedef std::deque<QueuedMessage> Messages;
- class Guard
- {
- qpid::sys::Condition condition;
- size_t count;
- public:
- Guard();
- void lock();
- void unlock();
- void wait(sys::Mutex&);
- };
-
const string name;
const bool autodelete;
MessageStore* store;
@@ -88,7 +77,6 @@ namespace qpid {
mutable qpid::sys::Mutex consumerLock;
mutable qpid::sys::Mutex messageLock;
mutable qpid::sys::Mutex ownershipLock;
- Guard notifierLock;
mutable uint64_t persistenceId;
framing::FieldTable settings;
std::auto_ptr<QueuePolicy> policy;