[llvm-commits] [llvm] r82896 - /llvm/trunk/lib/Support/Statistic.cpp
Torok Edwin
edwintorok at gmail.com
Sun Sep 27 04:08:03 PDT 2009
Author: edwin
Date: Sun Sep 27 06:08:03 2009
New Revision: 82896
URL: http://llvm.org/viewvc/llvm-project?rev=82896&view=rev
Log:
Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex
in RegisterStatistic.
Modified:
llvm/trunk/lib/Support/Statistic.cpp
Modified: llvm/trunk/lib/Support/Statistic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Statistic.cpp?rev=82896&r1=82895&r2=82896&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Statistic.cpp (original)
+++ llvm/trunk/lib/Support/Statistic.cpp Sun Sep 27 06:08:03 2009
@@ -57,14 +57,14 @@
}
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);
More information about the llvm-commits
mailing list