summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-01-06 22:27:42 +0000
committerAlan Conway <aconway@apache.org>2009-01-06 22:27:42 +0000
commit820071d5a9959a2923269751ddcff2ed085b239a (patch)
tree79bbe068b2841d1a172a98784a7cdafee905cec2 /cpp/src
parentcd161749af72635be9721dbbd72cdffa76180e45 (diff)
downloadqpid-python-820071d5a9959a2923269751ddcff2ed085b239a.tar.gz
cluster/OutputInterceptor.cpp: added locking around use of ClusterOutputinterceptor.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@732153 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/cluster/OutputInterceptor.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/cpp/src/qpid/cluster/OutputInterceptor.cpp b/cpp/src/qpid/cluster/OutputInterceptor.cpp
index 075023caea..f37dda7738 100644
--- a/cpp/src/qpid/cluster/OutputInterceptor.cpp
+++ b/cpp/src/qpid/cluster/OutputInterceptor.cpp
@@ -40,14 +40,19 @@ OutputInterceptor::OutputInterceptor(
void OutputInterceptor::send(framing::AMQFrame& f) {
parent.getCluster().checkQuorum();
- next->send(f);
+ {
+ sys::Mutex::ScopedLock l(lock);
+ next->send(f);
+ }
if (!parent.isCatchUp())
sent += f.encodedSize();
}
void OutputInterceptor::activateOutput() {
- if (parent.isCatchUp())
+ if (parent.isCatchUp()) {
+ sys::Mutex::ScopedLock l(lock);
next->activateOutput();
+ }
else {
QPID_LOG(trace, parent << " activateOutput - sending doOutput");
moreOutput = true;
@@ -55,7 +60,10 @@ void OutputInterceptor::activateOutput() {
}
}
-void OutputInterceptor::giveReadCredit(int32_t credit) { next->giveReadCredit(credit); }
+void OutputInterceptor::giveReadCredit(int32_t credit) {
+ sys::Mutex::ScopedLock l(lock);
+ next->giveReadCredit(credit);
+}
// Called in write thread when the IO layer has no more data to write.
// We do nothing in the write thread, we run doOutput only on delivery
@@ -107,14 +115,17 @@ void OutputInterceptor::sendDoOutput() {
}
void OutputInterceptor::setOutputHandler(sys::ConnectionOutputHandler& h) {
+ sys::Mutex::ScopedLock l(lock);
next = &h;
}
void OutputInterceptor::close() {
+ sys::Mutex::ScopedLock l(lock);
next->close();
}
size_t OutputInterceptor::getBuffered() const {
+ sys::Mutex::ScopedLock l(lock);
return next->getBuffered();
}