mirror of https://github.com/mgba-emu/mgba.git
Core: Threads should not attempt to exit a thread that is already dead
This commit is contained in:
parent
159b0dc445
commit
762a54a388
|
@ -507,6 +507,10 @@ void mCoreThreadClearCrashed(struct mCoreThread* threadContext) {
|
||||||
|
|
||||||
void mCoreThreadEnd(struct mCoreThread* threadContext) {
|
void mCoreThreadEnd(struct mCoreThread* threadContext) {
|
||||||
MutexLock(&threadContext->impl->stateMutex);
|
MutexLock(&threadContext->impl->stateMutex);
|
||||||
|
if (threadContext->impl->state == mTHREAD_SHUTDOWN) {
|
||||||
|
MutexUnlock(&threadContext->impl->stateMutex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_waitOnInterrupt(threadContext->impl);
|
_waitOnInterrupt(threadContext->impl);
|
||||||
threadContext->impl->state = mTHREAD_EXITING;
|
threadContext->impl->state = mTHREAD_EXITING;
|
||||||
ConditionWake(&threadContext->impl->stateOnThreadCond);
|
ConditionWake(&threadContext->impl->stateOnThreadCond);
|
||||||
|
|
Loading…
Reference in New Issue