mirror of https://github.com/mgba-emu/mgba.git
Fix edge case with video-frame sync where it may never wake up the display thread
This commit is contained in:
parent
70f94db208
commit
0d1b323e22
|
@ -520,10 +520,12 @@ void GBASyncPostFrame(struct GBASync* sync) {
|
|||
++sync->videoFramePending;
|
||||
--sync->videoFrameSkip;
|
||||
if (sync->videoFrameSkip < 0) {
|
||||
ConditionWake(&sync->videoFrameAvailableCond);
|
||||
while (sync->videoFrameWait && sync->videoFramePending) {
|
||||
ConditionWait(&sync->videoFrameRequiredCond, &sync->videoFrameMutex);
|
||||
}
|
||||
do {
|
||||
ConditionWake(&sync->videoFrameAvailableCond);
|
||||
if (sync->videoFrameWait) {
|
||||
ConditionWait(&sync->videoFrameRequiredCond, &sync->videoFrameMutex);
|
||||
}
|
||||
} while (sync->videoFrameWait && sync->videoFramePending);
|
||||
}
|
||||
MutexUnlock(&sync->videoFrameMutex);
|
||||
|
||||
|
|
Loading…
Reference in New Issue