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
2 files changed,
9 insertions(+),
0 deletions(-)
M
src/gba/gba-thread.c
→
src/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.h
→
src/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);