summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Statistic.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-22 23:08:27 +0000
committerOwen Anderson <resistor@mac.com>2009-06-22 23:08:27 +0000
commit975ce637db60bed08c0bd6805f92465b6b5f1a66 (patch)
tree8756090010f0cc7c96f76c9dccb3e7f330c2d7ca /llvm/lib/Support/Statistic.cpp
parent77b50e1126b8699a170c48cef8a91f80a1127f25 (diff)
downloadbcm5719-llvm-975ce637db60bed08c0bd6805f92465b6b5f1a66.tar.gz
bcm5719-llvm-975ce637db60bed08c0bd6805f92465b6b5f1a66.zip
Guard the statistics table.
llvm-svn: 73916
Diffstat (limited to 'llvm/lib/Support/Statistic.cpp')
-rw-r--r--llvm/lib/Support/Statistic.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index 13acc1b0fa1..6c652f8d3f1 100644
--- a/llvm/lib/Support/Statistic.cpp
+++ b/llvm/lib/Support/Statistic.cpp
@@ -25,6 +25,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Streams.h"
+#include "llvm/System/Mutex.h"
#include "llvm/ADT/StringExtras.h"
#include <algorithm>
#include <ostream>
@@ -57,13 +58,14 @@ public:
}
static ManagedStatic<StatisticInfo> StatInfo;
-
+static ManagedStatic<sys::Mutex> 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);
if (Enabled)
StatInfo->addStatistic(this);
// Remember we have been registered.
OpenPOWER on IntegriCloud