Core Stop and Start: Added alternative separate thread timer/loop based waiting, instead of same thread loop waiting. You can try it with the SETUP_TIMER_WAITING option in Setup.h.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2375 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-22 21:16:12 +00:00
parent 769160dfbd
commit 927815bc9b
16 changed files with 367 additions and 31 deletions

View File

@ -17,10 +17,14 @@
#include <string.h>
#include "Setup.h"
#ifdef SETUP_TIMER_WAITING
#include "../../../Plugins/Plugin_VideoOGL/Src/OS/Win32.h"
#endif
#include "MemoryUtil.h"
#include "Thread.h"
#include "OpcodeDecoding.h"
#include "Setup.h"
#include "ConsoleWindow.h"
#include "Fifo.h"
@ -96,8 +100,18 @@ void Video_SendFifoData(u8* _uData, u32 len)
void Fifo_ExitLoop()
{
fifoStateRun = false;
fifo_exit_event.Wait();
fifo_exit_event.Shutdown();
#ifndef SETUP_TIMER_WAITING
fifo_exit_event.Wait();
fifo_exit_event.Shutdown();
#else
//Console::Print("Video: Fifo_ExitLoop: Done:%i\n", fifo_exit_event.DoneWait());
if (fifo_exit_event.TimerWait(Fifo_ExitLoop))
{
//Console::Print("Video: Fifo_Shutdown: Done:%i\n\n", fifo_exit_event.DoneWait());
fifo_exit_event.Shutdown();
PostMessage(EmuWindow::GetParentWnd(), WM_USER, OPENGL_VIDEO_STOP, 0);
}
#endif
}
void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
@ -111,6 +125,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
#if defined(_WIN32) && !defined(SETUP_AVOID_OPENGL_SCREEN_MESSAGE_HANG)
video_initialize.pPeekMessages();
#endif
if (_fifo.CPReadWriteDistance == 0)
Common::SleepCurrentThread(1);
@ -187,4 +202,7 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
}
}
fifo_exit_event.Set();
#ifdef SETUP_TIMER_WAITING
fifo_exit_event.SetTimer();
#endif
}