mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-25 10:38:44 +00:00
Avoid using mutex locks if not in multithreaded mode by using a SmartScopedMutex
in RegisterStatistic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82896 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e298ab26b1
commit
d7830d595d
@ -57,14 +57,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ManagedStatic<StatisticInfo> StatInfo;
|
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
|
/// RegisterStatistic - The first time a statistic is bumped, this method is
|
||||||
/// called.
|
/// called.
|
||||||
void Statistic::RegisterStatistic() {
|
void Statistic::RegisterStatistic() {
|
||||||
// If stats are enabled, inform StatInfo that this statistic should be
|
// If stats are enabled, inform StatInfo that this statistic should be
|
||||||
// printed.
|
// printed.
|
||||||
sys::ScopedLock Writer(*StatLock);
|
sys::SmartScopedLock<true> Writer(*StatLock);
|
||||||
if (!Initialized) {
|
if (!Initialized) {
|
||||||
if (Enabled)
|
if (Enabled)
|
||||||
StatInfo->addStatistic(this);
|
StatInfo->addStatistic(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user