Merge pull request #4153 from unknownbrackets/shutdown

The shutdown adjustments keep coming
This commit is contained in:
Henrik Rydgård 2013-10-13 00:21:18 -07:00
commit 03766f562f
3 changed files with 8 additions and 7 deletions

View file

@ -435,9 +435,9 @@ void __IoManagerThread() {
}
void __IoWakeManager() {
// Ping the thread so that it knows to check coreState.
ioManagerThreadEnabled = false;
ioManager.FinishEventLoop();
ioManager.SyncThread();
}
void __IoInit() {

View file

@ -269,13 +269,10 @@ void Core_UpdateState(CoreState newState) {
}
void System_Wake() {
if (CPU_IsReady()) {
CPU_NextStateNot(CPU_THREAD_NOT_RUNNING, CPU_THREAD_SHUTDOWN);
CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown);
}
// Ping the threads so they check coreState.
CPU_NextStateNot(CPU_THREAD_NOT_RUNNING, CPU_THREAD_SHUTDOWN);
if (gpu) {
gpu->FinishEventLoop();
gpu->SyncThread();
}
}

View file

@ -11,7 +11,7 @@ namespace DSound
CRITICAL_SECTION soundCriticalSection;
HANDLE soundSyncEvent = NULL;
HANDLE hThread;
HANDLE hThread = NULL;
StreamCallback callback;
@ -195,6 +195,8 @@ namespace DSound
if (!dsBuffer)
return;
EnterCriticalSection(&soundCriticalSection);
if (threadData == 0)
threadData = 1;
@ -202,6 +204,7 @@ namespace DSound
{
WaitForSingleObject(hThread, 1000);
CloseHandle(hThread);
hThread = NULL;
}
if (threadData == 2)
@ -217,6 +220,7 @@ namespace DSound
if (soundSyncEvent != NULL)
CloseHandle(soundSyncEvent);
soundSyncEvent = NULL;
LeaveCriticalSection(&soundCriticalSection);
}