[llvm-commits] [llvm] r79255 - /llvm/trunk/lib/VMCore/Attributes.cpp
Owen Anderson
resistor at mac.com
Mon Aug 17 10:10:58 PDT 2009
Author: resistor
Date: Mon Aug 17 12:10:58 2009
New Revision: 79255
URL: http://llvm.org/viewvc/llvm-project?rev=79255&view=rev
Log:
Add locking around the attributes list.
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=79255&r1=79254&r2=79255&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Mon Aug 17 12:10:58 2009
@@ -15,6 +15,7 @@
#include "llvm/Type.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/FoldingSet.h"
+#include "llvm/System/Mutex.h"
#include "llvm/Support/Streams.h"
#include "llvm/Support/ManagedStatic.h"
using namespace llvm;
@@ -124,9 +125,11 @@
};
}
+static ManagedStatic<sys::SmartMutex<true> > ALMutex;
static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
AttributeListImpl::~AttributeListImpl() {
+ sys::SmartScopedLock<true> Lock(*ALMutex);
AttributesLists->RemoveNode(this);
}
@@ -149,6 +152,9 @@
FoldingSetNodeID ID;
AttributeListImpl::Profile(ID, Attrs, NumAttrs);
void *InsertPos;
+
+ sys::SmartScopedLock<true> Lock(*ALMutex);
+
AttributeListImpl *PAL =
AttributesLists->FindNodeOrInsertPos(ID, InsertPos);
More information about the llvm-commits
mailing list