diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp index 46c377037542a..8334b6b4db908 100644 --- a/cmds/statsd/src/external/StatsPullerManager.cpp +++ b/cmds/statsd/src/external/StatsPullerManager.cpp @@ -315,6 +315,7 @@ void StatsPullerManager::OnAlarmFired(int64_t elapsedTimeNs) { } int StatsPullerManager::ForceClearPullerCache() { + std::lock_guard _l(mLock); int totalCleared = 0; for (const auto& pulledAtom : kAllPullAtomInfo) { totalCleared += pulledAtom.second->ForceClearCache(); @@ -323,6 +324,7 @@ int StatsPullerManager::ForceClearPullerCache() { } int StatsPullerManager::ClearPullerCacheIfNecessary(int64_t timestampNs) { + std::lock_guard _l(mLock); int totalCleared = 0; for (const auto& pulledAtom : kAllPullAtomInfo) { totalCleared += pulledAtom.second->ClearCacheIfNecessary(timestampNs);