From f1393567e0749d502a544e2a4a4f2817651932c8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 12 Oct 2004 02:48:12 +0000 Subject: [PATCH] * Reworked shutdown sequence to avoid thread deadlock --- citadel/ChangeLog | 4 ++++ citadel/server_main.c | 19 +------------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 468ba8b5e..cb2686653 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 626.10 2004/10/12 02:48:11 ajc + * Reworked shutdown sequence to avoid thread deadlock + Revision 626.9 2004/10/12 02:17:49 ajc * Cleaned up some things that generated compiler warnings * crypto keys directory is now relative to the server's working directory, @@ -6153,3 +6156,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/server_main.c b/citadel/server_main.c index 6020ebf54..e770bc6f4 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -71,7 +71,6 @@ int main(int argc, char **argv) int a, i; /* General-purpose variables */ struct passwd *pw; int drop_root_perms = 1; - struct worker_node *wnp; size_t size; /* specify default port name and trace file */ @@ -233,23 +232,7 @@ int main(int argc, char **argv) worker_thread(NULL); /* Server is exiting. Wait for workers to shutdown. */ - lprintf(CTDL_INFO, "Waiting for worker threads to shut down\n"); - - begin_critical_section(S_WORKER_LIST); - while (worker_list != NULL) { - wnp = worker_list; - worker_list = wnp->next; - - /* avoid deadlock with an exiting thread */ - end_critical_section(S_WORKER_LIST); - if ((i = pthread_join(wnp->tid, NULL))) { - lprintf(CTDL_CRIT, "pthread_join: %s\n", strerror(i)); - } - free(wnp); - begin_critical_section(S_WORKER_LIST); - } - end_critical_section(S_WORKER_LIST); - + lprintf(CTDL_INFO, "Server is shutting down.\n"); master_cleanup(); return(0); } -- 2.30.2