mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 19:04:00 +02:00
Removed unnecessary template usage.
This commit is contained in:
@@ -46,7 +46,7 @@ protected:
|
|||||||
cacheItemSet
|
cacheItemSet
|
||||||
} CacheAccessorType;
|
} CacheAccessorType;
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
static Mutex & manageCachedItemMutex(string cacheKey) {
|
static Mutex & manageCachedItemMutex(string cacheKey) {
|
||||||
if(itemCacheMutexList.find(cacheKey) == itemCacheMutexList.end()) {
|
if(itemCacheMutexList.find(cacheKey) == itemCacheMutexList.end()) {
|
||||||
MutexSafeWrapper safeMutex(&mutexMap);
|
MutexSafeWrapper safeMutex(&mutexMap);
|
||||||
@@ -66,7 +66,7 @@ protected:
|
|||||||
if(accessor == cacheItemSet) {
|
if(accessor == cacheItemSet) {
|
||||||
if(value == NULL) {
|
if(value == NULL) {
|
||||||
try {
|
try {
|
||||||
Mutex &mutexCache = manageCachedItemMutex<T>(cacheKey);
|
Mutex &mutexCache = manageCachedItemMutex(cacheKey);
|
||||||
MutexSafeWrapper safeMutex(&mutexCache);
|
MutexSafeWrapper safeMutex(&mutexCache);
|
||||||
if(itemCache.find(cacheKey) != itemCache.end()) {
|
if(itemCache.find(cacheKey) != itemCache.end()) {
|
||||||
itemCache.erase(cacheKey);
|
itemCache.erase(cacheKey);
|
||||||
@@ -80,7 +80,7 @@ protected:
|
|||||||
}
|
}
|
||||||
if(value != NULL) {
|
if(value != NULL) {
|
||||||
try {
|
try {
|
||||||
Mutex &mutexCache = manageCachedItemMutex<T>(cacheKey);
|
Mutex &mutexCache = manageCachedItemMutex(cacheKey);
|
||||||
MutexSafeWrapper safeMutex(&mutexCache);
|
MutexSafeWrapper safeMutex(&mutexCache);
|
||||||
itemCache[cacheKey] = *value;
|
itemCache[cacheKey] = *value;
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
@@ -91,7 +91,7 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If this is the first access we return a default object of the type
|
// If this is the first access we return a default object of the type
|
||||||
Mutex &mutexCache = manageCachedItemMutex<T>(cacheKey);
|
Mutex &mutexCache = manageCachedItemMutex(cacheKey);
|
||||||
MutexSafeWrapper safeMutex(&mutexCache);
|
MutexSafeWrapper safeMutex(&mutexCache);
|
||||||
|
|
||||||
return itemCache[cacheKey];
|
return itemCache[cacheKey];
|
||||||
@@ -129,7 +129,7 @@ public:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static Mutex & getMutexForItem(string cacheKey) {
|
static Mutex & getMutexForItem(string cacheKey) {
|
||||||
return manageCachedItemMutex<T>(cacheKey);
|
return manageCachedItemMutex(cacheKey);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user