mirror of https://github.com/mgba-emu/mgba.git
GBA Thread: Properly stop thread when video wait is enabled
This commit is contained in:
parent
3fdf8fe316
commit
52f8f51133
|
@ -360,6 +360,12 @@ void GBAThreadEnd(struct GBAThread* threadContext) {
|
||||||
threadContext->sync.audioWait = 0;
|
threadContext->sync.audioWait = 0;
|
||||||
ConditionWake(&threadContext->sync.audioRequiredCond);
|
ConditionWake(&threadContext->sync.audioRequiredCond);
|
||||||
MutexUnlock(&threadContext->sync.audioBufferMutex);
|
MutexUnlock(&threadContext->sync.audioBufferMutex);
|
||||||
|
|
||||||
|
MutexLock(&threadContext->sync.videoFrameMutex);
|
||||||
|
threadContext->sync.videoFrameWait = false;
|
||||||
|
threadContext->sync.videoFrameOn = false;
|
||||||
|
ConditionWake(&threadContext->sync.videoFrameRequiredCond);
|
||||||
|
MutexUnlock(&threadContext->sync.videoFrameMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAThreadReset(struct GBAThread* threadContext) {
|
void GBAThreadReset(struct GBAThread* threadContext) {
|
||||||
|
@ -371,11 +377,6 @@ void GBAThreadReset(struct GBAThread* threadContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBAThreadJoin(struct GBAThread* threadContext) {
|
void GBAThreadJoin(struct GBAThread* threadContext) {
|
||||||
MutexLock(&threadContext->sync.videoFrameMutex);
|
|
||||||
threadContext->sync.videoFrameWait = 0;
|
|
||||||
ConditionWake(&threadContext->sync.videoFrameRequiredCond);
|
|
||||||
MutexUnlock(&threadContext->sync.videoFrameMutex);
|
|
||||||
|
|
||||||
ThreadJoin(threadContext->thread);
|
ThreadJoin(threadContext->thread);
|
||||||
|
|
||||||
MutexDeinit(&threadContext->stateMutex);
|
MutexDeinit(&threadContext->stateMutex);
|
||||||
|
|
Loading…
Reference in New Issue