httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/server/mpm/threaded threaded.c
Date Tue, 20 Feb 2001 20:50:11 GMT
rbb         01/02/20 12:50:10

  Modified:    .        CHANGES
               server/mpm/threaded threaded.c
  Log:
  Migrate the threaded MPM to use all APR threading calls.  This isn't quite
  perfect yet, because of the sigwait and sigmask calls.  Those are going
  away next.
  
  Revision  Changes    Path
  1.99      +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -d -b -w -u -r1.98 -r1.99
  --- CHANGES	2001/02/18 02:10:25	1.98
  +++ CHANGES	2001/02/20 20:50:05	1.99
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.12-dev
   
  +  *) Make the threaded MPM use APR threads instead of pthreads.
  +     [Ryan Bloom]
  +
     *) Get mod_tls to the point where it actually appears to work in all cases.
        [Ben Laurie]
   
  
  
  
  1.5       +6 -25     httpd-2.0/server/mpm/threaded/threaded.c
  
  Index: threaded.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -d -b -w -u -r1.4 -r1.5
  --- threaded.c	2001/02/20 10:37:34	1.4
  +++ threaded.c	2001/02/20 20:50:09	1.5
  @@ -586,8 +586,8 @@
   {
       sigset_t sig_mask;
       int signal_received;
  -    pthread_t thread;
  -    pthread_attr_t thread_attr;
  +    apr_thread_t *thread;
  +    apr_threadattr_t *thread_attr;
       int i;
       int my_child_num = child_num_arg;
       proc_info *my_info = NULL;
  @@ -651,16 +651,9 @@
                       NULL, pchild);
       apr_lock_create(&pipe_of_death_mutex, APR_MUTEX, APR_INTRAPROCESS, 
                       NULL, pchild);
  -    pthread_attr_init(&thread_attr);
  -#ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR
  -    {
  -        int on = 1;
  +    apr_threadattr_create(&thread_attr, pchild);
  +    apr_threadattr_detach_set(thread_attr);
   
  -        pthread_attr_setdetachstate(&thread_attr, &on);
  -    }
  -#else
  -    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
  -#endif
       for (i=0; i < ap_threads_per_child; i++) {
   
   	my_info = (proc_info *)malloc(sizeof(proc_info));
  @@ -677,31 +670,19 @@
   	/* We are creating threads right now */
   	(void) ap_update_child_status(my_child_num, i, SERVER_STARTING, 
   				      (request_rec *) NULL);
  -#ifndef NO_THREADS
  -	if ((rv = pthread_create(&thread, &thread_attr, worker_thread, my_info))) {
  -#ifdef PTHREAD_SETS_ERRNO
  -            rv = errno;
  -#endif
  +	if ((rv = apr_thread_create(&thread, thread_attr, worker_thread, my_info, pchild)))
{
   	    ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf,
  -			 "pthread_create: unable to create worker thread");
  +			 "apr_thread_create: unable to create worker thread");
               /* In case system resources are maxxed out, we don't want
                  Apache running away with the CPU trying to fork over and
                  over and over again if we exit. */
               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.
   	 */
       }
  -
  -    pthread_attr_destroy(&thread_attr);
   
       /* This thread will be the one responsible for handling signals */
       sigemptyset(&sig_mask);
  
  
  

Mime
View raw message