- attempt to protect cache manager mutex creation behind a static mutex

This commit is contained in:
SoftCoder 2017-10-07 11:04:52 -07:00
parent b928bbbb40
commit a413fb5c31
1 changed files with 3 additions and 0 deletions

View File

@ -48,8 +48,11 @@ protected:
template <typename T>
static Mutex & manageCachedItemMutex(string cacheKey) {
static Mutex mutexMap(CODE_AT_LINE);
if(itemCacheMutexList.find(cacheKey) == itemCacheMutexList.end()) {
MutexSafeWrapper safeMutex(&mutexMap);
itemCacheMutexList[cacheKey] = new Mutex(CODE_AT_LINE);
safeMutex.ReleaseLock();
}
Mutex *mutex = itemCacheMutexList[cacheKey];
return *mutex;