From 4a5c2eaa9eb38de9b9c4416f4fa37ede1e7d2295 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Thu, 15 Mar 2012 14:24:32 +0000 Subject: 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 --- qpid/cpp/include/qpid/framing/FieldTable.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'qpid/cpp/include') 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 -#include + +#include "qpid/framing/amqp_types.h" +#include "qpid/sys/Mutex.h" + #include #include + +#include #include -#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 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); }; -- cgit v1.2.1