mirror of https://github.com/mgba-emu/mgba.git
GBA Thread: Fix possible deadlock in video sync
This commit is contained in:
parent
1273ab4ca5
commit
848cf162af
1
CHANGES
1
CHANGES
|
@ -37,6 +37,7 @@ Bugfixes:
|
||||||
- Debugger: Disassembly now lists PSR bitmasks (fixes #191)
|
- Debugger: Disassembly now lists PSR bitmasks (fixes #191)
|
||||||
- GBA BIOS: Prevent CpuSet and CpuFastSet from using BIOS addresses as a source (fixes #184)
|
- GBA BIOS: Prevent CpuSet and CpuFastSet from using BIOS addresses as a source (fixes #184)
|
||||||
- GBA RR: Fix fallthrough error when reading tags from a movie
|
- GBA RR: Fix fallthrough error when reading tags from a movie
|
||||||
|
- GBA Thread: Fix possible deadlock in video sync
|
||||||
Misc:
|
Misc:
|
||||||
- GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples
|
- GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples
|
||||||
- GBA Memory: Simplify memory API and use fixed bus width
|
- GBA Memory: Simplify memory API and use fixed bus width
|
||||||
|
|
|
@ -60,6 +60,11 @@ static void _waitOnInterrupt(struct GBAThread* threadContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _waitUntilNotState(struct GBAThread* threadContext, enum ThreadState oldState) {
|
static void _waitUntilNotState(struct GBAThread* threadContext, enum ThreadState oldState) {
|
||||||
|
MutexLock(&threadContext->sync.videoFrameMutex);
|
||||||
|
bool videoFrameWait = threadContext->sync.videoFrameWait;
|
||||||
|
threadContext->sync.videoFrameWait = false;
|
||||||
|
MutexUnlock(&threadContext->sync.videoFrameMutex);
|
||||||
|
|
||||||
while (threadContext->state == oldState) {
|
while (threadContext->state == oldState) {
|
||||||
MutexUnlock(&threadContext->stateMutex);
|
MutexUnlock(&threadContext->stateMutex);
|
||||||
|
|
||||||
|
@ -74,6 +79,10 @@ static void _waitUntilNotState(struct GBAThread* threadContext, enum ThreadState
|
||||||
MutexLock(&threadContext->stateMutex);
|
MutexLock(&threadContext->stateMutex);
|
||||||
ConditionWake(&threadContext->stateCond);
|
ConditionWake(&threadContext->stateCond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MutexLock(&threadContext->sync.videoFrameMutex);
|
||||||
|
threadContext->sync.videoFrameWait = videoFrameWait;
|
||||||
|
MutexUnlock(&threadContext->sync.videoFrameMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _pauseThread(struct GBAThread* threadContext, bool onThread) {
|
static void _pauseThread(struct GBAThread* threadContext, bool onThread) {
|
||||||
|
|
Loading…
Reference in New Issue