Core: Add existing state check for rewind
Jeffrey Pfau jeffrey@endrift.com
Wed, 26 Oct 2016 21:41:44 -0700
2 files changed,
9 insertions(+),
0 deletions(-)
M
src/core/thread.c
→
src/core/thread.c
@@ -478,6 +478,14 @@ }
void mCoreThreadSetRewinding(struct mCoreThread* threadContext, bool rewinding) { MutexLock(&threadContext->stateMutex); + if (rewinding && (threadContext->state == THREAD_REWINDING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_REWINDING))) { + MutexUnlock(&threadContext->stateMutex); + return; + } + if (!rewinding && (threadContext->state == THREAD_RUNNING || (threadContext->state == THREAD_INTERRUPTING && threadContext->savedState == THREAD_RUNNING))) { + MutexUnlock(&threadContext->stateMutex); + return; + } _waitOnInterrupt(threadContext); if (rewinding && threadContext->state == THREAD_RUNNING) { threadContext->state = THREAD_REWINDING;