all repos — mgba @ 2e2ca19220c6ce39079c95e5eb923af02fcf4a69

mGBA Game Boy Advance Emulator

Add GBAThreadEnd function for manually shutting down the GBA thread
Jeffrey Pfau jeffrey@endrift.com
Tue, 28 Jan 2014 23:15:30 -0800
commit

2e2ca19220c6ce39079c95e5eb923af02fcf4a69

parent

c8b04a2ca583d0f9f70f7bdff1c4d7d462e1ce4c

2 files changed, 10 insertions(+), 0 deletions(-)

jump to
M src/gba/gba-thread.csrc/gba/gba-thread.c

@@ -193,6 +193,15 @@

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;
M src/gba/gba-thread.hsrc/gba/gba-thread.h

@@ -64,6 +64,7 @@ int rewindBufferWriteOffset;

}; int GBAThreadStart(struct GBAThread* threadContext); +void GBAThreadEnd(struct GBAThread* threadContext); void GBAThreadJoin(struct GBAThread* threadContext); void GBAThreadPause(struct GBAThread* threadContext);