diff --git a/src/core/thread.c b/src/core/thread.c index 988ce0848..92d134120 100644 --- a/src/core/thread.c +++ b/src/core/thread.c @@ -507,6 +507,10 @@ void mCoreThreadClearCrashed(struct mCoreThread* threadContext) { void mCoreThreadEnd(struct mCoreThread* threadContext) { MutexLock(&threadContext->impl->stateMutex); + if (threadContext->impl->state == mTHREAD_SHUTDOWN) { + MutexUnlock(&threadContext->impl->stateMutex); + return; + } _waitOnInterrupt(threadContext->impl); threadContext->impl->state = mTHREAD_EXITING; ConditionWake(&threadContext->impl->stateOnThreadCond);