Core: Threads should not attempt to exit a thread that is already dead

This commit is contained in:
Vicki Pfau 2025-01-12 06:01:10 -08:00
parent 159b0dc445
commit 762a54a388
1 changed files with 4 additions and 0 deletions

View File

@ -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);