mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 15:41:24 +02:00
- sound system is now threaded by default (hopefully this fixes buffer underruns errors from openal)
- background music now plays when game is loading
This commit is contained in:
@@ -63,6 +63,9 @@ protected:
|
||||
bool taskSignalled;
|
||||
bool needTaskSignal;
|
||||
|
||||
Mutex mutexLastExecuteTimestamp;
|
||||
time_t lastExecuteTimestamp;
|
||||
|
||||
public:
|
||||
SimpleTaskThread();
|
||||
SimpleTaskThread(SimpleTaskCallbackInterface *simpleTaskInterface,
|
||||
@@ -74,6 +77,8 @@ public:
|
||||
|
||||
void setTaskSignalled(bool value);
|
||||
bool getTaskSignalled();
|
||||
|
||||
bool isThreadExecutionLagging();
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
|
@@ -85,6 +85,18 @@ SimpleTaskThread::SimpleTaskThread( SimpleTaskCallbackInterface *simpleTaskInter
|
||||
this->millisecsBetweenExecutions = millisecsBetweenExecutions;
|
||||
this->needTaskSignal = needTaskSignal;
|
||||
setTaskSignalled(false);
|
||||
|
||||
MutexSafeWrapper safeMutex(&mutexLastExecuteTimestamp);
|
||||
lastExecuteTimestamp = time(NULL);
|
||||
}
|
||||
|
||||
bool SimpleTaskThread::isThreadExecutionLagging() {
|
||||
bool result = false;
|
||||
MutexSafeWrapper safeMutex(&mutexLastExecuteTimestamp);
|
||||
result = (difftime(time(NULL),lastExecuteTimestamp) >= 5.0);
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool SimpleTaskThread::canShutdown(bool deleteSelfIfShutdownDelayed) {
|
||||
@@ -124,8 +136,12 @@ void SimpleTaskThread::execute() {
|
||||
else if(runTask == true) {
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
|
||||
if(getQuitStatus() == false) {
|
||||
ExecutingTaskSafeWrapper safeExecutingTaskMutex(this);
|
||||
ExecutingTaskSafeWrapper safeExecutingTaskMutex(this);
|
||||
this->simpleTaskInterface->simpleTask(this);
|
||||
|
||||
MutexSafeWrapper safeMutex(&mutexLastExecuteTimestamp);
|
||||
lastExecuteTimestamp = time(NULL);
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->getUniqueID().c_str());
|
||||
}
|
||||
|
Reference in New Issue
Block a user