You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 1999/07/29 22:43:31 UTC

cvs commit: apache-2.0/mpm/src/modules/mpm/mpmt_pthread mpm_default.h mpmt_pthread.c

manoj       99/07/29 13:43:31

  Modified:    mpm/src/modules/mpm/mpmt_pthread mpm_default.h
                        mpmt_pthread.c
  Log:
  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.
  
  Revision  Changes    Path
  1.3       +9 -0      apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpm_default.h
  
  Index: mpm_default.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpm_default.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -d -u -r1.2 -r1.3
  --- mpm_default.h	1999/07/19 05:17:49	1.2
  +++ mpm_default.h	1999/07/29 20:43:28	1.3
  @@ -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
  
  
  
  1.17      +6 -2      apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -d -u -r1.16 -r1.17
  --- mpmt_pthread.c	1999/07/29 20:06:20	1.16
  +++ mpmt_pthread.c	1999/07/29 20:43:28	1.17
  @@ -1052,6 +1052,7 @@
   	/* 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 @@
               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 @@
   
           RAISE_SIGSTOP(MAKE_CHILD);
   
  -	/* XXX - For an unthreaded server, a signal handler will be necessary
           signal(SIGTERM, just_die);
  -	*/
           child_main(slot);
   
   	return 0;