mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Use atomic operations when accessing statistics, and make the lazy initialization of statistics actually threadsafe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74005 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -66,10 +66,14 @@ 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.
|
||||
Initialized = true;
|
||||
if (!Initialized) {
|
||||
if (Enabled)
|
||||
StatInfo->addStatistic(this);
|
||||
|
||||
sys::MemoryFence();
|
||||
// Remember we have been registered.
|
||||
Initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
Reference in New Issue
Block a user