Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex
authorTorok Edwin <edwintorok@gmail.com>
Sun, 27 Sep 2009 11:08:03 +0000 (11:08 +0000)
committerTorok Edwin <edwintorok@gmail.com>
Sun, 27 Sep 2009 11:08:03 +0000 (11:08 +0000)
in RegisterStatistic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82896 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Statistic.cpp

index 5ad5698..14f94bc 100644 (file)
@@ -57,14 +57,14 @@ public:
 }
 
 static ManagedStatic<StatisticInfo> StatInfo;
-static ManagedStatic<sys::Mutex> StatLock;
+static ManagedStatic<sys::SmartMutex<true> > StatLock;
 
 /// RegisterStatistic - The first time a statistic is bumped, this method is
 /// called.
 void Statistic::RegisterStatistic() {
   // If stats are enabled, inform StatInfo that this statistic should be
   // printed.
-  sys::ScopedLock Writer(*StatLock);
+  sys::SmartScopedLock<true> Writer(*StatLock);
   if (!Initialized) {
     if (Enabled)
       StatInfo->addStatistic(this);