mirror of https://github.com/mgba-emu/mgba.git
Core: Fix possible video sync deadlock
This commit is contained in:
parent
39324749f2
commit
bb74b60cd9
|
@ -49,11 +49,11 @@ bool mCoreSyncWaitFrameStart(struct mCoreSync* sync) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexLock(&sync->videoFrameMutex);
|
MutexLock(&sync->videoFrameMutex);
|
||||||
ConditionWake(&sync->videoFrameRequiredCond);
|
|
||||||
if (!sync->videoFrameWait && !sync->videoFramePending) {
|
if (!sync->videoFrameWait && !sync->videoFramePending) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sync->videoFrameWait) {
|
if (sync->videoFrameWait) {
|
||||||
|
ConditionWake(&sync->videoFrameRequiredCond);
|
||||||
if (ConditionWaitTimed(&sync->videoFrameAvailableCond, &sync->videoFrameMutex, 50)) {
|
if (ConditionWaitTimed(&sync->videoFrameAvailableCond, &sync->videoFrameMutex, 50)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ void mCoreSyncWaitFrameEnd(struct mCoreSync* sync) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConditionWake(&sync->videoFrameRequiredCond);
|
||||||
MutexUnlock(&sync->videoFrameMutex);
|
MutexUnlock(&sync->videoFrameMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue