Index: src/log.cc |
diff --git a/src/log.cc b/src/log.cc |
index 21d64df21c7abb426964b2f50377143f705a6120..d93a9d82b117022e629f9f84530578e15efed611 100644 |
--- a/src/log.cc |
+++ b/src/log.cc |
@@ -1730,13 +1730,20 @@ void Logger::EnableSlidingStateWindow() { |
} |
// Protects the state below. |
-static LazyMutex active_samplers_mutex = LAZY_MUTEX_INITIALIZER; |
+static Mutex* active_samplers_mutex = NULL; |
List<Sampler*>* SamplerRegistry::active_samplers_ = NULL; |
+void SamplerRegistry::SetUp() { |
+ if (!active_samplers_mutex) { |
+ active_samplers_mutex = OS::CreateMutex(); |
+ } |
+} |
+ |
+ |
bool SamplerRegistry::IterateActiveSamplers(VisitSampler func, void* param) { |
- ScopedLock lock(active_samplers_mutex.Pointer()); |
+ ScopedLock lock(active_samplers_mutex); |
for (int i = 0; |
ActiveSamplersExist() && i < active_samplers_->length(); |
++i) { |
@@ -1763,7 +1770,7 @@ SamplerRegistry::State SamplerRegistry::GetState() { |
void SamplerRegistry::AddActiveSampler(Sampler* sampler) { |
ASSERT(sampler->IsActive()); |
- ScopedLock lock(active_samplers_mutex.Pointer()); |
+ ScopedLock lock(active_samplers_mutex); |
if (active_samplers_ == NULL) { |
active_samplers_ = new List<Sampler*>; |
} else { |
@@ -1775,7 +1782,7 @@ void SamplerRegistry::AddActiveSampler(Sampler* sampler) { |
void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
ASSERT(sampler->IsActive()); |
- ScopedLock lock(active_samplers_mutex.Pointer()); |
+ ScopedLock lock(active_samplers_mutex); |
ASSERT(active_samplers_ != NULL); |
bool removed = active_samplers_->RemoveElement(sampler); |
ASSERT(removed); |