diff options
| author | Gordon Sim <gsim@apache.org> | 2007-11-08 10:08:26 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-11-08 10:08:26 +0000 |
| commit | 1debda48ca18e4615260ee48c907cfc5c2ab1d1b (patch) | |
| tree | b7cd04d575456ee4a490c2a02e9056b8e64ff799 /qpid/cpp/src | |
| parent | a26a61c4604f8453c54b4bebae865748b7b21071 (diff) | |
| download | qpid-python-1debda48ca18e4615260ee48c907cfc5c2ab1d1b.tar.gz | |
Ensure browsers are always serviced on the serializers dispatch thread to avoid concurrent servicing threads interfering with each other.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@593112 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.cpp | 3 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.h | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp index 44ed743880..a250009c77 100644 --- a/qpid/cpp/src/qpid/broker/Queue.cpp +++ b/qpid/cpp/src/qpid/broker/Queue.cpp @@ -138,7 +138,8 @@ void Queue::requestDispatch(Consumer::ptr c){ if (!c || c->preAcquires()) { serializer.execute(dispatchCallback); } else { - serviceBrowser(c); + DispatchFunctor f(*this, c); + serializer.execute(f); } } diff --git a/qpid/cpp/src/qpid/broker/Queue.h b/qpid/cpp/src/qpid/broker/Queue.h index f247312b60..e554c1011a 100644 --- a/qpid/cpp/src/qpid/broker/Queue.h +++ b/qpid/cpp/src/qpid/broker/Queue.h @@ -66,11 +66,18 @@ namespace qpid { struct DispatchFunctor { Queue& queue; + Consumer::ptr consumer; DispatchCompletion* sync; + DispatchFunctor(Queue& q, DispatchCompletion* s = 0) : queue(q), sync(s) {} + DispatchFunctor(Queue& q, Consumer::ptr c, DispatchCompletion* s = 0) : queue(q), consumer(c), sync(s) {} void operator()() { - queue.dispatch(); + if (consumer && !consumer->preAcquires()) { + queue.serviceBrowser(consumer); + }else{ + queue.dispatch(); + } if (sync) sync->completed(); } }; |
