* Do not turn the initial thread into a worker thread after initialization.
authorArt Cancro <ajc@citadel.org>
Thu, 2 Jun 2005 03:39:44 +0000 (03:39 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 2 Jun 2005 03:39:44 +0000 (03:39 +0000)
  Its stack size is too small, which could cause crashes.

citadel/ChangeLog
citadel/server_main.c

index 3c075a6498beaf2fdf2d20d15a0eff90808577d6..7d417c34f093506b65a101b5c1b713e28fb2cd46 100644 (file)
@@ -6764,4 +6764,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index fdf8e15893fcfaa7f667fd5537cba72dfe701f3f..3c610aba915ae23e95de5a140df1216becc5f86d 100644 (file)
@@ -234,7 +234,8 @@ int main(int argc, char **argv)
        /*
         * Now create a bunch of worker threads.
         */
-       lprintf(CTDL_DEBUG, "Starting %d worker threads\n", config.c_min_workers-1);
+       lprintf(CTDL_DEBUG, "Starting %d worker threads\n",
+               config.c_min_workers-1);
        begin_critical_section(S_WORKER_LIST);
        for (i=0; i<(config.c_min_workers-1); ++i) {
                create_worker();
@@ -244,11 +245,12 @@ int main(int argc, char **argv)
        /* Create the indexer thread. */
        create_indexer_thread();
 
-       /* Now this thread can become a worker as well. */
-       worker_thread(NULL);
-
-       /* Server is exiting. Wait for workers to shutdown. */
-       lprintf(CTDL_INFO, "Server is shutting down.\n");
+       /* This thread is now useless.  It can't be turned into a worker
+        * thread because its stack is too small, but it can't be killed
+        * either because the whole server process would exit.  So we just
+        * join to the first worker thread and exit when it exits.
+        */
+       pthread_join(worker_list->tid, NULL);
        master_cleanup(0);
        return(0);
 }