summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2012-03-15 14:24:32 +0000
committerAndrew Stitcher <astitcher@apache.org>2012-03-15 14:24:32 +0000
commit4a5c2eaa9eb38de9b9c4416f4fa37ede1e7d2295 (patch)
treed6944b45f11ac892b1a1a33113c92b0279314825 /qpid/cpp/include
parent2179e8f3b41138356f49a16800a2945248fdae17 (diff)
downloadqpid-python-4a5c2eaa9eb38de9b9c4416f4fa37ede1e7d2295.tar.gz
QPID-3893: C++ broker appears to segfault during MultipleTransactedBatchProducerTest
Added in lock to preserve the previous read/write concurrency guarantees of FieldTable in the face of the new caching. Fix extra unnecessary decodes git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1301001 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qpid/framing/FieldTable.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/qpid/cpp/include/qpid/framing/FieldTable.h b/qpid/cpp/include/qpid/framing/FieldTable.h
index 293fb2eed7..1986a72d10 100644
--- a/qpid/cpp/include/qpid/framing/FieldTable.h
+++ b/qpid/cpp/include/qpid/framing/FieldTable.h
@@ -1,3 +1,6 @@
+#ifndef _FieldTable_
+#define _FieldTable_
+
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -18,16 +21,17 @@
* under the License.
*
*/
-#include <iostream>
-#include <vector>
+
+#include "qpid/framing/amqp_types.h"
+#include "qpid/sys/Mutex.h"
+
#include <boost/shared_ptr.hpp>
#include <boost/shared_array.hpp>
+
+#include <iosfwd>
#include <map>
-#include "qpid/framing/amqp_types.h"
-#include "qpid/CommonImportExport.h"
-#ifndef _FieldTable_
-#define _FieldTable_
+#include "qpid/CommonImportExport.h"
namespace qpid {
/**
@@ -114,11 +118,13 @@ class FieldTable
private:
void realDecode() const;
- void flushRawCache() const;
+ void flushRawCache();
+ mutable qpid::sys::Mutex lock;
mutable ValueMap values;
mutable boost::shared_array<uint8_t> cachedBytes;
mutable uint32_t cachedSize; // if = 0 then non cached size as 0 is not a legal size
+ mutable bool newBytes;
QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream& out, const FieldTable& body);
};