[llvm-commits] [llvm] r79486 - /llvm/trunk/lib/VMCore/Attributes.cpp
Owen Anderson
resistor at mac.com
Wed Aug 19 15:58:34 PDT 2009
Author: resistor
Date: Wed Aug 19 17:58:34 2009
New Revision: 79486
URL: http://llvm.org/viewvc/llvm-project?rev=79486&view=rev
Log:
AttrListPtr operations need to be atomic.
Modified:
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=79486&r1=79485&r2=79486&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Wed Aug 19 17:58:34 2009
@@ -175,14 +175,17 @@
//===----------------------------------------------------------------------===//
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 @@
}
AttrListPtr::~AttrListPtr() {
+ sys::SmartScopedLock<true> Lock(*ALMutex);
if (AttrList) AttrList->DropRef();
}
More information about the llvm-commits
mailing list