mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:30:05 +00:00
Lock the level 2 product record mutex before searching for records
This commit is contained in:
parent
881502c970
commit
4471843f8b
1 changed files with 20 additions and 15 deletions
|
|
@ -1164,10 +1164,14 @@ RadarProductManagerImpl::GetLevel2ProductRecords(
|
||||||
// Ensure Level 2 product records are updated
|
// Ensure Level 2 product records are updated
|
||||||
PopulateLevel2ProductTimes(time);
|
PopulateLevel2ProductTimes(time);
|
||||||
|
|
||||||
|
{
|
||||||
|
std::shared_lock lock {level2ProductRecordMutex_};
|
||||||
|
|
||||||
if (!level2ProductRecords_.empty() &&
|
if (!level2ProductRecords_.empty() &&
|
||||||
time == std::chrono::system_clock::time_point {})
|
time == std::chrono::system_clock::time_point {})
|
||||||
{
|
{
|
||||||
// If a default-initialized time point is given, return the latest record
|
// If a default-initialized time point is given, return the latest
|
||||||
|
// record
|
||||||
recordPtrs.push_back(&(*level2ProductRecords_.rbegin()));
|
recordPtrs.push_back(&(*level2ProductRecords_.rbegin()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1187,6 +1191,7 @@ RadarProductManagerImpl::GetLevel2ProductRecords(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// For each record pointer
|
// For each record pointer
|
||||||
for (auto& recordPtr : recordPtrs)
|
for (auto& recordPtr : recordPtrs)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue