Merge "Fix thread safety issue on clearing cache" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
666deabeb8
@@ -334,6 +334,7 @@ void StatsPullerManager::OnAlarmFired(int64_t elapsedTimeNs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int StatsPullerManager::ForceClearPullerCache() {
|
int StatsPullerManager::ForceClearPullerCache() {
|
||||||
|
std::lock_guard<std::mutex> _l(mLock);
|
||||||
int totalCleared = 0;
|
int totalCleared = 0;
|
||||||
for (const auto& pulledAtom : kAllPullAtomInfo) {
|
for (const auto& pulledAtom : kAllPullAtomInfo) {
|
||||||
totalCleared += pulledAtom.second->ForceClearCache();
|
totalCleared += pulledAtom.second->ForceClearCache();
|
||||||
@@ -342,6 +343,7 @@ int StatsPullerManager::ForceClearPullerCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int StatsPullerManager::ClearPullerCacheIfNecessary(int64_t timestampNs) {
|
int StatsPullerManager::ClearPullerCacheIfNecessary(int64_t timestampNs) {
|
||||||
|
std::lock_guard<std::mutex> _l(mLock);
|
||||||
int totalCleared = 0;
|
int totalCleared = 0;
|
||||||
for (const auto& pulledAtom : kAllPullAtomInfo) {
|
for (const auto& pulledAtom : kAllPullAtomInfo) {
|
||||||
totalCleared += pulledAtom.second->ClearCacheIfNecessary(timestampNs);
|
totalCleared += pulledAtom.second->ClearCacheIfNecessary(timestampNs);
|
||||||
|
|||||||
Reference in New Issue
Block a user