From: Manoj Kasichainula Date: Thu, 29 Jul 1999 20:43:28 +0000 (+0000) Subject: Support non-threaded operation, for the most part. The code still X-Git-Tag: mpm-merge-1~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42fbf6064fe5be1713c1a5548bd9643cf3f0b9db;p=apache Support non-threaded operation, for the most part. The code still references pthread calls, but they are essentially no-ops in the non-threaded case; these can be #defined or wrapped away. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83530 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/mpmt_pthread/mpm_default.h b/server/mpm/mpmt_pthread/mpm_default.h index 32c70bb74e..538af6b836 100644 --- a/server/mpm/mpmt_pthread/mpm_default.h +++ b/server/mpm/mpmt_pthread/mpm_default.h @@ -90,6 +90,9 @@ * enough that we can read the whole thing without worrying too much about * the overhead. */ +#ifdef NO_THREADS +#define HARD_SERVER_LIMIT 256 +#endif #ifndef HARD_SERVER_LIMIT #define HARD_SERVER_LIMIT 8 #endif @@ -101,10 +104,16 @@ * enough that we can read the whole thing without worrying too much about * the overhead. */ +#ifdef NO_THREADS +#define HARD_THREAD_LIMIT 1 +#endif #ifndef HARD_THREAD_LIMIT #define HARD_THREAD_LIMIT 64 #endif +#ifdef NO_THREADS +#define DEFAULT_THREADS_PER_CHILD 1 +#endif #ifndef DEFAULT_THREADS_PER_CHILD #define DEFAULT_THREADS_PER_CHILD 50 #endif diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 34ecea2997..49fd45af30 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1052,6 +1052,7 @@ static void child_main(int child_num_arg) /* We are creating threads right now */ (void) ap_update_child_status(my_child_num, i, SERVER_STARTING, (request_rec *) NULL); +#ifndef NO_THREADS if (pthread_create(&thread, &thread_attr, worker_thread, my_info)) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_create: unable to create worker thread"); @@ -1061,6 +1062,11 @@ static void child_main(int child_num_arg) sleep(10); clean_child_exit(APEXIT_CHILDFATAL); } +#else + worker_thread(my_info); + /* The SIGTERM shouldn't let us reach this point, but just in case... */ + clean_child_exit(APEXIT_OK); +#endif /* We let each thread update it's own scoreboard entry. This is done * because it let's us deal with tid better. @@ -1125,9 +1131,7 @@ static int make_child(server_rec *s, int slot, time_t now) /* ZZZ */ RAISE_SIGSTOP(MAKE_CHILD); - /* XXX - For an unthreaded server, a signal handler will be necessary signal(SIGTERM, just_die); - */ child_main(slot); return 0;