Lock the state change on exiting a thread.
authorDave West <davew@uncensored.citadel.org>
Fri, 30 Nov 2007 17:59:07 +0000 (17:59 +0000)
committerDave West <davew@uncensored.citadel.org>
Fri, 30 Nov 2007 17:59:07 +0000 (17:59 +0000)
citadel/sysdep.c

index 5358fb3d403c4e93ffb515211d8819c984af74e6..918b11aa26e4e80d77ba310d6ca8c388d3d946d0 100644 (file)
@@ -1442,7 +1442,9 @@ static void ctdl_internal_thread_cleanup(void *arg)
        #ifdef HAVE_BACKTRACE
        eCrash_UnregisterThread();
        #endif
+       pthread_mutex_lock(&this_thread->ThreadMutex);
        this_thread->state = CTDL_THREAD_EXITED;        // needs to be last thing else house keeping will unlink us too early
+       pthread_mutex_unlock(&this_thread->ThreadMutex);
        end_critical_section(S_THREAD_LIST);
 //     CtdlThreadGC();
 }