aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-19 22:58:34 +0000
committerOwen Anderson <resistor@mac.com>2009-08-19 22:58:34 +0000
commit22cdac5eef039e05beb790211d71eccd45ee190f (patch)
tree00c38b5aecbe91f46c6be3308e81b1fea9c9e364
parente457538ed815e5a52322618d1f114e2ae579da74 (diff)
downloadexternal_llvm-22cdac5eef039e05beb790211d71eccd45ee190f.zip
external_llvm-22cdac5eef039e05beb790211d71eccd45ee190f.tar.gz
external_llvm-22cdac5eef039e05beb790211d71eccd45ee190f.tar.bz2
AttrListPtr operations need to be atomic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79486 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Attributes.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp
index 91c7320..73c92ec 100644
--- a/lib/VMCore/Attributes.cpp
+++ b/lib/VMCore/Attributes.cpp
@@ -175,14 +175,17 @@ AttrListPtr AttrListPtr::get(const AttributeWithIndex *Attrs, unsigned NumAttrs)
//===----------------------------------------------------------------------===//
AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
+ sys::SmartScopedLock<true> Lock(*ALMutex);
if (LI) LI->AddRef();
}
AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
+ sys::SmartScopedLock<true> Lock(*ALMutex);
if (AttrList) AttrList->AddRef();
}
const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
+ sys::SmartScopedLock<true> Lock(*ALMutex);
if (AttrList == RHS.AttrList) return *this;
if (AttrList) AttrList->DropRef();
AttrList = RHS.AttrList;
@@ -191,6 +194,7 @@ const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
}
AttrListPtr::~AttrListPtr() {
+ sys::SmartScopedLock<true> Lock(*ALMutex);
if (AttrList) AttrList->DropRef();
}