mirror of https://github.com/mgba-emu/mgba.git
Add GBAThreadEnd function for manually shutting down the GBA thread
This commit is contained in:
parent
c8b04a2ca5
commit
2e2ca19220
|
@ -193,6 +193,15 @@ int GBAThreadStart(struct GBAThread* threadContext) {
|
||||||
return 0;
|
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) {
|
void GBAThreadJoin(struct GBAThread* threadContext) {
|
||||||
MutexLock(&threadContext->sync.videoFrameMutex);
|
MutexLock(&threadContext->sync.videoFrameMutex);
|
||||||
threadContext->sync.videoFrameWait = 0;
|
threadContext->sync.videoFrameWait = 0;
|
||||||
|
|
|
@ -64,6 +64,7 @@ struct GBAThread {
|
||||||
};
|
};
|
||||||
|
|
||||||
int GBAThreadStart(struct GBAThread* threadContext);
|
int GBAThreadStart(struct GBAThread* threadContext);
|
||||||
|
void GBAThreadEnd(struct GBAThread* threadContext);
|
||||||
void GBAThreadJoin(struct GBAThread* threadContext);
|
void GBAThreadJoin(struct GBAThread* threadContext);
|
||||||
|
|
||||||
void GBAThreadPause(struct GBAThread* threadContext);
|
void GBAThreadPause(struct GBAThread* threadContext);
|
||||||
|
|
Loading…
Reference in New Issue