all repos — mgba @ eb232690114374d0307c5b5b00c3d520353b7f1c

mGBA Game Boy Advance Emulator

Add thread-safe function for telling if the GBA thread has started
Jeffrey Pfau jeffrey@endrift.com
Mon, 03 Feb 2014 03:41:32 -0800
commit

eb232690114374d0307c5b5b00c3d520353b7f1c

parent

6d12ef81a50c5ff070d2062ef256a6a4187eda86

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

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

@@ -185,6 +185,14 @@

return 0; } +int GBAThreadHasStarted(struct GBAThread* threadContext) { + int hasStarted; + MutexLock(&threadContext->stateMutex); + hasStarted = threadContext->state > THREAD_INITIALIZED; + MutexUnlock(&threadContext->stateMutex); + return hasStarted; +} + void GBAThreadEnd(struct GBAThread* threadContext) { MutexLock(&threadContext->stateMutex); if (threadContext->debugger && threadContext->debugger->state == DEBUGGER_RUNNING) {
M src/gba/gba-thread.hsrc/gba/gba-thread.h

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

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