From 6d0dcf31aac6aebd46fc0cd169ed19e099de808f Mon Sep 17 00:00:00 2001 From: Dave West Date: Fri, 30 Nov 2007 17:59:07 +0000 Subject: [PATCH] Lock the state change on exiting a thread. --- citadel/sysdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 5358fb3d4..918b11aa2 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -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(); } -- 2.39.2