]> code.citadel.org Git - citadel.git/blobdiff - citadel/server_main.c
* There is now a dedicated thread for doing database checkpoints.
[citadel.git] / citadel / server_main.c
index 75c6c713752a4139f5aa8f8c5c4eb5ba6fbe98d5..6497d37871423acb56d9a9520b05e30272db795f 100644 (file)
@@ -234,18 +234,23 @@ 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();
        }
        end_critical_section(S_WORKER_LIST);
 
-       /* Now this thread can become a worker as well. */
-       worker_thread(NULL);
+       /* Create the indexer thread. */
+       create_maintenance_threads();
 
-       /* 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);
 }