- attempt to make TOM happy, clickl madly while game is loading and help lame windows not choke

This commit is contained in:
Mark Vejvoda
2010-06-17 06:55:35 +00:00
parent eeda623b4f
commit b2f91e0f32
8 changed files with 70 additions and 5 deletions

View File

@@ -155,4 +155,38 @@ bool SimpleTaskThread::getTaskSignalled() {
return retval;
}
PumpSDLEventsTaskThread::PumpSDLEventsTaskThread() : BaseThread() {
}
void PumpSDLEventsTaskThread::execute() {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
setRunningStatus(true);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"SDL_PumpEvents thread is running\n");
try {
unsigned int idx = 0;
for(;getQuitStatus() == false;) {
SDL_PumpEvents();
sleep(100);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
setRunningStatus(false);
}
catch(...) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] unknown error\n",__FILE__,__FUNCTION__,__LINE__);
setRunningStatus(false);
}
setRunningStatus(false);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"SDL_PumpEvents thread is exiting\n");
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
}}//end namespace

View File

@@ -19,6 +19,15 @@ namespace Shared{ namespace Platform{
// =====================================
// Threads
// =====================================
Thread::Thread() {
thread = NULL;
}
Thread::~Thread() {
if(thread != NULL) {
SDL_WaitThread(thread, NULL);
}
}
void Thread::start() {
thread = SDL_CreateThread(beginExecution, this);