mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
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__);
|
||||
vector<string> techDataPaths = config.getPathListForType(ptTechs);
|
||||
|
||||
FileCRCPreCacheThread::setPreCacheThreadCacheLookupKey(GameConstants::preCacheThreadCacheLookupKey);
|
||||
FileCRCPreCacheThread * &preCacheCRCThreadPtr = CacheManager::getCachedItem< FileCRCPreCacheThread * >(GameConstants::preCacheThreadCacheLookupKey);
|
||||
if(preCacheCRCThreadPtr == NULL) {
|
||||
preCacheCRCThreadPtr = new FileCRCPreCacheThread();
|
||||
|
@ -47,6 +47,7 @@ protected:
|
||||
Mutex mutexPendingTextureList;
|
||||
vector<Texture2D *> pendingTextureList;
|
||||
|
||||
static string preCacheThreadCacheLookupKey;
|
||||
Mutex mutexPauseForGame;
|
||||
bool pauseForGame;
|
||||
std::vector<FileCRCPreCacheThread *> preCacheWorkerThreadList;
|
||||
@ -57,6 +58,10 @@ protected:
|
||||
public:
|
||||
FileCRCPreCacheThread();
|
||||
FileCRCPreCacheThread(vector<string> techDataPaths,vector<string> workerThreadTechPaths,FileCRCPreCacheThreadCallbackInterface *processTechCB);
|
||||
virtual ~FileCRCPreCacheThread();
|
||||
|
||||
static void setPreCacheThreadCacheLookupKey(string value) { preCacheThreadCacheLookupKey = value; }
|
||||
|
||||
virtual void execute();
|
||||
void setTechDataPaths(vector<string> value) { this->techDataPaths = value; }
|
||||
void setWorkerThreadTechPaths(vector<string> value) { this->workerThreadTechPaths = value; }
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <algorithm>
|
||||
#include "conversion.h"
|
||||
#include "platform_util.h"
|
||||
#include "cache_manager.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace std;
|
||||
@ -26,6 +27,7 @@ namespace Shared { namespace PlatformCommon {
|
||||
|
||||
const static int MAX_FileCRCPreCacheThread_WORKER_THREADS = 3;
|
||||
const static double PAUSE_SECONDS_BETWEEN_WORKERS = 15;
|
||||
string FileCRCPreCacheThread::preCacheThreadCacheLookupKey = "";
|
||||
|
||||
FileCRCPreCacheThread::FileCRCPreCacheThread() : BaseThread() {
|
||||
techDataPaths.clear();
|
||||
@ -45,6 +47,14 @@ FileCRCPreCacheThread::FileCRCPreCacheThread(vector<string> techDataPaths,
|
||||
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) {
|
||||
static string mutexOwnerId = CODE_AT_LINE;
|
||||
MutexSafeWrapper safeMutex(&mutexPauseForGame,mutexOwnerId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user