Add GBAThreadEnd function for manually shutting down the GBA thread

This commit is contained in:
Jeffrey Pfau 2014-01-28 23:15:30 -08:00
parent c8b04a2ca5
commit 2e2ca19220
2 changed files with 10 additions and 0 deletions

View File

@ -193,6 +193,15 @@ int GBAThreadStart(struct GBAThread* threadContext) {
return 0;
}
void GBAThreadEnd(struct GBAThread* threadContext) {
MutexLock(&threadContext->stateMutex);
if (threadContext->debugger && threadContext->debugger->state == DEBUGGER_RUNNING) {
threadContext->debugger->state = DEBUGGER_EXITING;
}
threadContext->state = THREAD_EXITING;
MutexUnlock(&threadContext->stateMutex);
}
void GBAThreadJoin(struct GBAThread* threadContext) {
MutexLock(&threadContext->sync.videoFrameMutex);
threadContext->sync.videoFrameWait = 0;

View File

@ -64,6 +64,7 @@ struct GBAThread {
};
int GBAThreadStart(struct GBAThread* threadContext);
void GBAThreadEnd(struct GBAThread* threadContext);
void GBAThreadJoin(struct GBAThread* threadContext);
void GBAThreadPause(struct GBAThread* threadContext);