Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex
[oota-llvm.git] / lib / Support / Statistic.cpp
index 5ad569899ec895a9484417b99422ed9640ff11e9..14f94bc28447344b7a0f259abdecbb8be8c45fa1 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);