Skip to content

Commit 6ec925a

Browse files
Syncronize DefaultCacheImpl::Size (#1458)
Fixes data race between Open/Close and Size. Relates-To: OLPSUP-27831 Signed-off-by: Mykhailo Diachenko <ext-mykhailo.z.diachenko@here.com>
1 parent 18b35de commit 6ec925a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

olp-cpp-sdk-core/src/cache/DefaultCacheImpl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ void DefaultCacheImpl::SetEvictionPortion(uint64_t size) {
10871087
}
10881088

10891089
uint64_t DefaultCacheImpl::Size(CacheType type) const {
1090+
std::lock_guard<std::mutex> lock(cache_lock_);
10901091
if (type == CacheType::kMutable) {
10911092
return mutable_cache_data_size_;
10921093
}

0 commit comments

Comments
 (0)