From: Owen Anderson Date: Mon, 22 Jun 2009 23:08:27 +0000 (+0000) Subject: Guard the statistics table. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5de83afcdc3f4f0edf8caacba523f5d05ee48048;p=oota-llvm.git Guard the statistics table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73916 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp index 13acc1b0fa1..6c652f8d3f1 100644 --- a/lib/Support/Statistic.cpp +++ b/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 #include @@ -57,13 +58,14 @@ public: } static ManagedStatic StatInfo; - +static ManagedStatic 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.