- bugfix for chrono class calcs causing group camera recall to fail (And numerous other problems)

- added better tracking of mutexes by assigning them location info
This commit is contained in:
SoftCoder
2013-12-24 22:27:44 -08:00
parent 25326c64b1
commit 3111b733e2
32 changed files with 337 additions and 315 deletions

View File

@@ -29,17 +29,17 @@ namespace Shared { namespace PlatformCommon {
class BaseThread : public Thread
{
protected:
Mutex mutexRunning;
Mutex mutexQuit;
Mutex mutexBeginExecution;
Mutex mutexDeleteSelfOnExecutionDone;
Mutex *mutexRunning;
Mutex *mutexQuit;
Mutex *mutexBeginExecution;
Mutex *mutexDeleteSelfOnExecutionDone;
Mutex mutexThreadObjectAccessor;
Mutex *mutexThreadObjectAccessor;
bool threadOwnerValid;
Mutex mutexThreadOwnerValid;
Mutex *mutexThreadOwnerValid;
Mutex mutexExecutingTask;
Mutex *mutexExecutingTask;
bool executingTask;
void *ptr;
@@ -52,7 +52,7 @@ protected:
bool hasBeginExecution;
bool deleteSelfOnExecutionDone;
Mutex mutexStarted;
Mutex *mutexStarted;
bool started;
virtual void setQuitStatus(bool value);
@@ -96,7 +96,7 @@ public:
bool getThreadOwnerValid();
Mutex * getMutexThreadOwnerValid();
Mutex * getMutexThreadObjectAccessor() { return &mutexThreadObjectAccessor; }
Mutex * getMutexThreadObjectAccessor();
template <typename T>
T * getGenericData() {

View File

@@ -49,7 +49,7 @@ protected:
template <typename T>
static Mutex & manageCachedItemMutex(string cacheKey) {
if(itemCacheMutexList.find(cacheKey) == itemCacheMutexList.end()) {
itemCacheMutexList[cacheKey] = new Mutex();
itemCacheMutexList[cacheKey] = new Mutex(CODE_AT_LINE);
}
Mutex *mutex = itemCacheMutexList[cacheKey];
return *mutex;

View File

@@ -122,8 +122,8 @@ private:
Uint32 lastStartCount;
Uint32 lastTickCount;
int64 lastResult;
int lastMultiplier;
int32 lastResult;
int32 lastMultiplier;
bool lastStopped;
public:
@@ -135,11 +135,12 @@ public:
int64 getMillis();
int64 getSeconds();
bool isStarted() const;
static int64 getCurTicks();
static int64 getCurMillis();
private:
int64 queryCounter(int multiplier);
int64 queryCounter(int32 multiplier);
};
// =====================================================

View File

@@ -44,17 +44,11 @@ protected:
vector<string> workerThreadTechPaths;
FileCRCPreCacheThreadCallbackInterface *processTechCB;
Mutex mutexPendingTextureList;
vector<Texture2D *> pendingTextureList;
static string preCacheThreadCacheLookupKey;
Mutex mutexPauseForGame;
Mutex *mutexPauseForGame;
bool pauseForGame;
std::vector<FileCRCPreCacheThread *> preCacheWorkerThreadList;
void addPendingTexture(Texture2D *texture);
void addPendingTextureList(vector<Texture2D *> textureList);
public:
FileCRCPreCacheThread();
FileCRCPreCacheThread(vector<string> techDataPaths,vector<string> workerThreadTechPaths,FileCRCPreCacheThreadCallbackInterface *processTechCB);
@@ -66,7 +60,6 @@ public:
void setTechDataPaths(vector<string> value) { this->techDataPaths = value; }
void setWorkerThreadTechPaths(vector<string> value) { this->workerThreadTechPaths = value; }
void setFileCRCPreCacheThreadCallbackInterface(FileCRCPreCacheThreadCallbackInterface *value) { processTechCB = value; }
vector<Texture2D *> getPendingTextureList(int maxTexturesToGet);
virtual bool canShutdown(bool deleteSelfIfShutdownDelayed);
@@ -95,17 +88,17 @@ class SimpleTaskThread : public BaseThread
{
protected:
Mutex mutexSimpleTaskInterfaceValid;
Mutex *mutexSimpleTaskInterfaceValid;
bool simpleTaskInterfaceValid;
SimpleTaskCallbackInterface *simpleTaskInterface;
unsigned int executionCount;
unsigned int millisecsBetweenExecutions;
Mutex mutexTaskSignaller;
Mutex *mutexTaskSignaller;
bool taskSignalled;
bool needTaskSignal;
Mutex mutexLastExecuteTimestamp;
Mutex *mutexLastExecuteTimestamp;
time_t lastExecuteTimestamp;
taskFunctionCallback *overrideShutdownTask;
@@ -160,7 +153,7 @@ class LogFileThread : public BaseThread
{
protected:
Mutex mutexLogList;
Mutex *mutexLogList;
vector<LogFileEntry> logList;
time_t lastSaveToDisk;

View File

@@ -111,6 +111,7 @@ private:
SDL_mutex* mutexAccessor;
string lastownerId;
int maxRefCount;
Shared::PlatformCommon::Chrono *chronoPerf;
bool isStaticMutexListMutex;