Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex

in RegisterStatistic.

llvm-svn: 82896
This commit is contained in:
Torok Edwin 2009-09-27 11:08:03 +00:00
parent 67f09df0db
commit 819d15c7d9
1 changed files with 2 additions and 2 deletions

View 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);