In single core mode Emulation and CPU threads are now merged. Performance gain due to sleep elimination. Powerdown checks are already done in the CPU thread.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@532 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY
2008-09-15 21:46:26 +00:00
parent eafd38f6fb
commit ba90c68742

View File

@ -341,7 +341,7 @@ THREAD_RETURN EmuThread(void *pArg)
//CPU thread should in this case also create the emuwindow... //CPU thread should in this case also create the emuwindow...
//Spawn the CPU thread //Spawn the CPU thread
Common::Thread *cpuThread = new Common::Thread(CpuThread, pArg); Common::Thread *cpuThread = NULL;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// ENTER THE VIDEO THREAD LOOP // ENTER THE VIDEO THREAD LOOP
@ -349,7 +349,7 @@ THREAD_RETURN EmuThread(void *pArg)
if (!Core::GetStartupParameter().bUseDualCore) if (!Core::GetStartupParameter().bUseDualCore)
{ {
Common::SetCurrentThreadName("Idle thread"); /*Common::SetCurrentThreadName("Idle thread");
//TODO(ector) : investigate using GetMessage instead .. although //TODO(ector) : investigate using GetMessage instead .. although
//then we lose the powerdown check. ... unless powerdown sends a message :P //then we lose the powerdown check. ... unless powerdown sends a message :P
while (PowerPC::state != PowerPC::CPU_POWERDOWN) while (PowerPC::state != PowerPC::CPU_POWERDOWN)
@ -362,21 +362,28 @@ THREAD_RETURN EmuThread(void *pArg)
#else #else
Common::SleepCurrentThread(200); Common::SleepCurrentThread(200);
#endif #endif
} }*/
// In single-core mode, the Emulation main thread is also the CPU thread
CpuThread(pArg);
} }
else else
{ {
cpuThread = new Common::Thread(CpuThread, pArg);
PluginVideo::Video_Prepare(); //wglMakeCurrent PluginVideo::Video_Prepare(); //wglMakeCurrent
Common::SetCurrentThreadName("Video thread"); Common::SetCurrentThreadName("Video thread");
PluginVideo::Video_EnterLoop(); PluginVideo::Video_EnterLoop();
} }
// Wait for CPU thread to exit - it should have been signaled to do so by now // Wait for CPU thread to exit - it should have been signaled to do so by now
cpuThread->WaitForDeath(); if(cpuThread)
cpuThread->WaitForDeath();
if( g_pUpdateFPSDisplay != NULL ) if( g_pUpdateFPSDisplay != NULL )
g_pUpdateFPSDisplay("Stopping..."); g_pUpdateFPSDisplay("Stopping...");
delete cpuThread; if(cpuThread) {
cpuThread = NULL; delete cpuThread;
cpuThread = NULL;
}
// Returns after game exited // Returns after game exited
g_bHwInit = false; g_bHwInit = false;