mirror of https://github.com/mgba-emu/mgba.git
Add thread-safe function for telling if the GBA thread has started
This commit is contained in:
parent
0f6523941c
commit
285b94b66a
|
@ -185,6 +185,14 @@ int GBAThreadStart(struct GBAThread* threadContext) {
|
||||||
return 0;
|
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) {
|
void GBAThreadEnd(struct GBAThread* threadContext) {
|
||||||
MutexLock(&threadContext->stateMutex);
|
MutexLock(&threadContext->stateMutex);
|
||||||
if (threadContext->debugger && threadContext->debugger->state == DEBUGGER_RUNNING) {
|
if (threadContext->debugger && threadContext->debugger->state == DEBUGGER_RUNNING) {
|
||||||
|
|
|
@ -66,6 +66,7 @@ struct GBAThread {
|
||||||
};
|
};
|
||||||
|
|
||||||
int GBAThreadStart(struct GBAThread* threadContext);
|
int GBAThreadStart(struct GBAThread* threadContext);
|
||||||
|
int GBAThreadHasStarted(struct GBAThread* threadContext);
|
||||||
void GBAThreadEnd(struct GBAThread* threadContext);
|
void GBAThreadEnd(struct GBAThread* threadContext);
|
||||||
void GBAThreadJoin(struct GBAThread* threadContext);
|
void GBAThreadJoin(struct GBAThread* threadContext);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue