forked from OSchip/llvm-project
AttrListPtr operations need to be atomic.
llvm-svn: 79486
This commit is contained in:
parent
c59ba42b0f
commit
d6f7af652e
|
@ -175,14 +175,17 @@ AttrListPtr AttrListPtr::get(const AttributeWithIndex *Attrs, unsigned NumAttrs)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
|
AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) {
|
||||||
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
||||||
if (LI) LI->AddRef();
|
if (LI) LI->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
|
AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) {
|
||||||
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
||||||
if (AttrList) AttrList->AddRef();
|
if (AttrList) AttrList->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
|
const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
|
||||||
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
||||||
if (AttrList == RHS.AttrList) return *this;
|
if (AttrList == RHS.AttrList) return *this;
|
||||||
if (AttrList) AttrList->DropRef();
|
if (AttrList) AttrList->DropRef();
|
||||||
AttrList = RHS.AttrList;
|
AttrList = RHS.AttrList;
|
||||||
|
@ -191,6 +194,7 @@ const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AttrListPtr::~AttrListPtr() {
|
AttrListPtr::~AttrListPtr() {
|
||||||
|
sys::SmartScopedLock<true> Lock(*ALMutex);
|
||||||
if (AttrList) AttrList->DropRef();
|
if (AttrList) AttrList->DropRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue