X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fthreads.c;h=062d19911870dc59c20660dfe4b6838c82041924;hb=cdc34fa661ed54fdcebf86521496220cc28f4943;hp=a9fce4eb471282f59e5cbaf1ff5831496e9c3237;hpb=5bf6670f304602919abae191ba88232d693de1ff;p=citadel.git diff --git a/citadel/threads.c b/citadel/threads.c index a9fce4eb4..062d19911 100644 --- a/citadel/threads.c +++ b/citadel/threads.c @@ -183,7 +183,10 @@ void InitializeMasterTSD(void) { memset(&masterTSD, 0, sizeof(struct thread_tsd)); } +extern void ShutDownEventQueues(void); +int EventQShuttingDown = 0; +int EVQShutDown = 0; /* * Initialize the thread system */ @@ -211,6 +214,14 @@ void go_threading(void) } /* When we get to this point we are getting ready to shut down our Citadel server */ + if (!EventQShuttingDown) + { + EventQShuttingDown = 1; + ShutDownEventQueues(); + } + while (!EVQShutDown) + usleep(1000); + terminate_all_sessions(); /* close all client sockets */ CtdlShutdownServiceHooks(); /* close all listener sockets to prevent new connections */