diff options
author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2011-06-17 20:54:25 +0000 |
---|---|---|
committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2011-06-17 20:54:25 +0000 |
commit | 381b0b422fb2fa82d543eafd0b8051994a171cd8 (patch) | |
tree | b0974183984e2cbeaca983f1ac97e8ac9fcadeb7 | |
parent | de87285783cc3e029154224941be634287b69ba6 (diff) | |
download | qpid-python-381b0b422fb2fa82d543eafd0b8051994a171cd8.tar.gz |
QPID-3079: move QueueCompletion impl to source
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3079@1137018 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/PersistableQueue.h | 4 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.cpp | 18 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.h | 18 |
3 files changed, 22 insertions, 18 deletions
diff --git a/qpid/cpp/src/qpid/broker/PersistableQueue.h b/qpid/cpp/src/qpid/broker/PersistableQueue.h index 0f81b97b68..e8ff856e4b 100644 --- a/qpid/cpp/src/qpid/broker/PersistableQueue.h +++ b/qpid/cpp/src/qpid/broker/PersistableQueue.h @@ -63,14 +63,14 @@ public: inline ExternalQueueStore* getExternalQueueStore() const {return externalQueueStore;}; - PersistableQueue():externalQueueStore(NULL) { + PersistableQueue():externalQueueStore(NULL){ }; /** the message has finished being dequeued from the store */ virtual void dequeueComplete(const boost::intrusive_ptr<PersistableMessage>&) = 0; protected: - ExternalQueueStore *externalQueueStore; + ExternalQueueStore* externalQueueStore; }; diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp index c3e9f4ea3a..0520099d90 100644 --- a/qpid/cpp/src/qpid/broker/Queue.cpp +++ b/qpid/cpp/src/qpid/broker/Queue.cpp @@ -1256,3 +1256,21 @@ void Queue::UsageBarrier::destroy() parent.deleted = true; while (count) parent.messageLock.wait(); } + + +void Queue::DequeueCompletion::dequeueDone() +{ + assert(completionsNeeded.get() > 0); + if (--completionsNeeded == 0) { + assert(cb); + (*cb)(ctxt); + ctxt.reset(); + } +} + +void Queue::DequeueCompletion::registerCallback( callback *f, boost::intrusive_ptr<RefCounted>& _ctxt ) +{ + cb = f; + ctxt = _ctxt; + dequeueDone(); // invoke callback if dequeue already done. +} diff --git a/qpid/cpp/src/qpid/broker/Queue.h b/qpid/cpp/src/qpid/broker/Queue.h index 0215870f90..3bcaf0f473 100644 --- a/qpid/cpp/src/qpid/broker/Queue.h +++ b/qpid/cpp/src/qpid/broker/Queue.h @@ -295,22 +295,8 @@ class Queue : public boost::enable_shared_from_this<Queue>, : completionsNeeded(2), // one for register call, another for done call cb(0) {} - void dequeueDone() - { - assert(completionsNeeded.get() > 0); - if (--completionsNeeded == 0) { - assert(cb); - (*cb)(ctxt); - ctxt.reset(); - } - } - - void registerCallback( callback *f, boost::intrusive_ptr<RefCounted>& _ctxt ) - { - cb = f; - ctxt = _ctxt; - dequeueDone(); // invoke callback if dequeue already done. - } + void dequeueDone(); + void registerCallback( callback *f, boost::intrusive_ptr<RefCounted>& _ctxt ); private: mutable qpid::sys::AtomicValue<int> completionsNeeded; |