all repos — mgba @ 6c6d09ee7c7c916c4f448dc7ece4fccd7a25e9af

mGBA Game Boy Advance Emulator

Core: Improved threading interrupted detection
Vicki Pfau vi@endrift.com
Wed, 28 Jun 2017 14:10:31 -0700
commit

6c6d09ee7c7c916c4f448dc7ece4fccd7a25e9af

parent

dc5c59d4dbe157bb1c6fe1e00c0893815723a16b

2 files changed, 7 insertions(+), 6 deletions(-)

jump to
M CHANGESCHANGES

@@ -143,6 +143,7 @@ - Core: Config values can now be hexadecimal

- GB: Reset with initial state of DIV register - GB MBC: New MBC7 implementation - Qt: Better highlight active key in control binding + - Core: Improved threading interrupted detection 0.5.2: (2016-12-31) Bugfixes:
M src/core/thread.csrc/core/thread.c

@@ -468,7 +468,7 @@

bool mCoreThreadIsPaused(struct mCoreThread* threadContext) { bool isPaused; MutexLock(&threadContext->stateMutex); - if (threadContext->state == THREAD_INTERRUPTED || threadContext->state == THREAD_INTERRUPTING) { + if (threadContext->interruptDepth) { isPaused = threadContext->savedState == THREAD_PAUSED; } else { isPaused = threadContext->state == THREAD_PAUSED;

@@ -498,7 +498,7 @@

void mCoreThreadPauseFromThread(struct mCoreThread* threadContext) { bool frameOn = true; MutexLock(&threadContext->stateMutex); - if (threadContext->state == THREAD_RUNNING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_RUNNING)) { + if (threadContext->state == THREAD_RUNNING || (threadContext->interruptDepth && threadContext->savedState == THREAD_RUNNING)) { threadContext->state = THREAD_PAUSING; frameOn = false; }

@@ -509,11 +509,11 @@ }

void mCoreThreadSetRewinding(struct mCoreThread* threadContext, bool rewinding) { MutexLock(&threadContext->stateMutex); - if (rewinding && (threadContext->state == THREAD_REWINDING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_REWINDING))) { + if (rewinding && (threadContext->state == THREAD_REWINDING || (threadContext->interruptDepth && threadContext->savedState == THREAD_REWINDING))) { MutexUnlock(&threadContext->stateMutex); return; } - if (!rewinding && (threadContext->state == THREAD_RUNNING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_RUNNING))) { + if (!rewinding && ((!threadContext->interruptDepth && threadContext->state != THREAD_REWINDING) || (threadContext->interruptDepth && threadContext->savedState != THREAD_REWINDING))) { MutexUnlock(&threadContext->stateMutex); return; }

@@ -529,7 +529,7 @@ }

void mCoreThreadWaitFromThread(struct mCoreThread* threadContext) { MutexLock(&threadContext->stateMutex); - if ((threadContext->state == THREAD_INTERRUPTED || threadContext->state == THREAD_INTERRUPTING) && threadContext->savedState == THREAD_RUNNING) { + if (threadContext->interruptDepth && threadContext->savedState == THREAD_RUNNING) { threadContext->savedState = THREAD_WAITING; } else if (threadContext->state == THREAD_RUNNING) { threadContext->state = THREAD_WAITING;

@@ -539,7 +539,7 @@ }

void mCoreThreadStopWaiting(struct mCoreThread* threadContext) { MutexLock(&threadContext->stateMutex); - if ((threadContext->state == THREAD_INTERRUPTED || threadContext->state == THREAD_INTERRUPTING) && threadContext->savedState == THREAD_WAITING) { + if (threadContext->interruptDepth && threadContext->savedState == THREAD_WAITING) { threadContext->savedState = THREAD_RUNNING; } else if (threadContext->state == THREAD_WAITING) { threadContext->state = THREAD_RUNNING;