bugfix for precache crc thread unpause on game end
This commit is contained in:
parent
e712f307c3
commit
d32de80491
|
@ -5292,6 +5292,7 @@ int glestMain(int argc, char** argv) {
|
||||||
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
|
static string mutexOwnerId = string(extractFileFromDirectoryPath(__FILE__).c_str()) + string("_") + intToStr(__LINE__);
|
||||||
vector<string> techDataPaths = config.getPathListForType(ptTechs);
|
vector<string> techDataPaths = config.getPathListForType(ptTechs);
|
||||||
|
|
||||||
|
FileCRCPreCacheThread::setPreCacheThreadCacheLookupKey(GameConstants::preCacheThreadCacheLookupKey);
|
||||||
FileCRCPreCacheThread * &preCacheCRCThreadPtr = CacheManager::getCachedItem< FileCRCPreCacheThread * >(GameConstants::preCacheThreadCacheLookupKey);
|
FileCRCPreCacheThread * &preCacheCRCThreadPtr = CacheManager::getCachedItem< FileCRCPreCacheThread * >(GameConstants::preCacheThreadCacheLookupKey);
|
||||||
if(preCacheCRCThreadPtr == NULL) {
|
if(preCacheCRCThreadPtr == NULL) {
|
||||||
preCacheCRCThreadPtr = new FileCRCPreCacheThread();
|
preCacheCRCThreadPtr = new FileCRCPreCacheThread();
|
||||||
|
|
|
@ -47,6 +47,7 @@ protected:
|
||||||
Mutex mutexPendingTextureList;
|
Mutex mutexPendingTextureList;
|
||||||
vector<Texture2D *> pendingTextureList;
|
vector<Texture2D *> pendingTextureList;
|
||||||
|
|
||||||
|
static string preCacheThreadCacheLookupKey;
|
||||||
Mutex mutexPauseForGame;
|
Mutex mutexPauseForGame;
|
||||||
bool pauseForGame;
|
bool pauseForGame;
|
||||||
std::vector<FileCRCPreCacheThread *> preCacheWorkerThreadList;
|
std::vector<FileCRCPreCacheThread *> preCacheWorkerThreadList;
|
||||||
|
@ -57,6 +58,10 @@ protected:
|
||||||
public:
|
public:
|
||||||
FileCRCPreCacheThread();
|
FileCRCPreCacheThread();
|
||||||
FileCRCPreCacheThread(vector<string> techDataPaths,vector<string> workerThreadTechPaths,FileCRCPreCacheThreadCallbackInterface *processTechCB);
|
FileCRCPreCacheThread(vector<string> techDataPaths,vector<string> workerThreadTechPaths,FileCRCPreCacheThreadCallbackInterface *processTechCB);
|
||||||
|
virtual ~FileCRCPreCacheThread();
|
||||||
|
|
||||||
|
static void setPreCacheThreadCacheLookupKey(string value) { preCacheThreadCacheLookupKey = value; }
|
||||||
|
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
void setTechDataPaths(vector<string> value) { this->techDataPaths = value; }
|
void setTechDataPaths(vector<string> value) { this->techDataPaths = value; }
|
||||||
void setWorkerThreadTechPaths(vector<string> value) { this->workerThreadTechPaths = value; }
|
void setWorkerThreadTechPaths(vector<string> value) { this->workerThreadTechPaths = value; }
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
|
#include "cache_manager.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -26,6 +27,7 @@ namespace Shared { namespace PlatformCommon {
|
||||||
|
|
||||||
const static int MAX_FileCRCPreCacheThread_WORKER_THREADS = 3;
|
const static int MAX_FileCRCPreCacheThread_WORKER_THREADS = 3;
|
||||||
const static double PAUSE_SECONDS_BETWEEN_WORKERS = 15;
|
const static double PAUSE_SECONDS_BETWEEN_WORKERS = 15;
|
||||||
|
string FileCRCPreCacheThread::preCacheThreadCacheLookupKey = "";
|
||||||
|
|
||||||
FileCRCPreCacheThread::FileCRCPreCacheThread() : BaseThread() {
|
FileCRCPreCacheThread::FileCRCPreCacheThread() : BaseThread() {
|
||||||
techDataPaths.clear();
|
techDataPaths.clear();
|
||||||
|
@ -45,6 +47,14 @@ FileCRCPreCacheThread::FileCRCPreCacheThread(vector<string> techDataPaths,
|
||||||
uniqueID = "FileCRCPreCacheThread";
|
uniqueID = "FileCRCPreCacheThread";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileCRCPreCacheThread::~FileCRCPreCacheThread() {
|
||||||
|
bool threadControllerMode = (workerThreadTechPaths.size() == 0);
|
||||||
|
FileCRCPreCacheThread * &preCacheCRCThreadPtr = CacheManager::getCachedItem< FileCRCPreCacheThread * >(preCacheThreadCacheLookupKey);
|
||||||
|
if(preCacheCRCThreadPtr != NULL && threadControllerMode == true) {
|
||||||
|
preCacheCRCThreadPtr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FileCRCPreCacheThread::setPauseForGame(bool pauseForGame) {
|
void FileCRCPreCacheThread::setPauseForGame(bool pauseForGame) {
|
||||||
static string mutexOwnerId = CODE_AT_LINE;
|
static string mutexOwnerId = CODE_AT_LINE;
|
||||||
MutexSafeWrapper safeMutex(&mutexPauseForGame,mutexOwnerId);
|
MutexSafeWrapper safeMutex(&mutexPauseForGame,mutexOwnerId);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user