mirror of
https://github.com/glest/glest-source.git
synced 2025-08-08 09:26:27 +02:00
- attempt to protect cache manager mutex creation behind a static mutex
This commit is contained in:
@@ -48,8 +48,11 @@ protected:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static Mutex & manageCachedItemMutex(string cacheKey) {
|
static Mutex & manageCachedItemMutex(string cacheKey) {
|
||||||
|
static Mutex mutexMap(CODE_AT_LINE);
|
||||||
if(itemCacheMutexList.find(cacheKey) == itemCacheMutexList.end()) {
|
if(itemCacheMutexList.find(cacheKey) == itemCacheMutexList.end()) {
|
||||||
|
MutexSafeWrapper safeMutex(&mutexMap);
|
||||||
itemCacheMutexList[cacheKey] = new Mutex(CODE_AT_LINE);
|
itemCacheMutexList[cacheKey] = new Mutex(CODE_AT_LINE);
|
||||||
|
safeMutex.ReleaseLock();
|
||||||
}
|
}
|
||||||
Mutex *mutex = itemCacheMutexList[cacheKey];
|
Mutex *mutex = itemCacheMutexList[cacheKey];
|
||||||
return *mutex;
|
return *mutex;
|
||||||
|
Reference in New Issue
Block a user