- added conditional check to only issue a stop command to units if they are not already stopped

- memory cleanup on unit errors
- mutex for checksum class
This commit is contained in:
Mark Vejvoda
2011-03-23 00:49:21 +00:00
parent 37127cccfc
commit 8a9505e1e8
4 changed files with 22 additions and 6 deletions

View File

@@ -23,6 +23,7 @@
#include "util.h"
#include "platform_common.h"
#include "conversion.h"
#include "leak_dumper.h"
using namespace std;
@@ -34,6 +35,7 @@ namespace Shared{ namespace Util{
// class Checksum
// =====================================================
Mutex Checksum::fileListCacheSynchAccessor;
std::map<string,int32> Checksum::fileListCache;
Checksum::Checksum() {
@@ -189,6 +191,8 @@ int32 Checksum::getSum() {
Checksum newResult;
for(std::map<string,int32>::iterator iterMap = fileList.begin();
iterMap != fileList.end(); iterMap++) {
MutexSafeWrapper safeMutexSocketDestructorFlag(&Checksum::fileListCacheSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
if(Checksum::fileListCache.find(iterMap->first) == Checksum::fileListCache.end()) {
Checksum fileResult;
fileResult.addFileToSum(iterMap->first);
@@ -213,12 +217,14 @@ int32 Checksum::getFileCount() {
}
void Checksum::removeFileFromCache(const string file) {
MutexSafeWrapper safeMutexSocketDestructorFlag(&Checksum::fileListCacheSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
if(Checksum::fileListCache.find(file) != Checksum::fileListCache.end()) {
Checksum::fileListCache.erase(file);
}
}
void Checksum::clearFileCache() {
MutexSafeWrapper safeMutexSocketDestructorFlag(&Checksum::fileListCacheSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
Checksum::fileListCache.clear();
}