httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/worker worker.c
Date Wed, 17 Oct 2001 00:59:18 GMT
aaron       01/10/16 17:59:18

  Modified:    server/mpm/worker worker.c
  Log:
  First pass at converting worker MPM to APR's new lock API. This converts
  the APR_INTRAPROCESS locks into lightweight, non-nested apr_thread_mutex_t
  locks.
  
  Revision  Changes    Path
  1.28      +14 -13    httpd-2.0/server/mpm/worker/worker.c
  
  Index: worker.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- worker.c	2001/09/24 06:42:12	1.27
  +++ worker.c	2001/10/17 00:59:18	1.28
  @@ -69,6 +69,7 @@
   #include "apr_file_io.h"
   #include "apr_thread_proc.h"
   #include "apr_signal.h"
  +#include "apr_thread_mutex.h"
   #define APR_WANT_STRFUNC
   #include "apr_want.h"
   
  @@ -152,8 +153,8 @@
   
   static apr_file_t *pipe_of_death_in = NULL;
   static apr_file_t *pipe_of_death_out = NULL;
  -static apr_lock_t *pipe_of_death_mutex;   /* insures that a child process only
  -                                             consumes one character */
  +/* insures that a child process only consumes one character */
  +static apr_thread_mutex_t *pipe_of_death_mutex;
   
   /* *Non*-shared http_main globals... */
   
  @@ -186,7 +187,7 @@
   static pid_t parent_pid;
   /* Keep track of the number of worker threads currently active */
   static int worker_thread_count;
  -static apr_lock_t *worker_thread_count_mutex;
  +static apr_thread_mutex_t *worker_thread_count_mutex;
   
   /* Locks for accept serialization */
   static apr_lock_t *accept_mutex;
  @@ -531,7 +532,7 @@
   /* Sets workers_may_exit if we received a character on the pipe_of_death */
   static void check_pipe_of_death(void)
   {
  -    apr_lock_acquire(pipe_of_death_mutex);
  +    apr_thread_mutex_lock(pipe_of_death_mutex);
       if (!workers_may_exit) {
           apr_status_t ret;
           char pipe_read_char;
  @@ -548,7 +549,7 @@
               signal_workers();
           }
       }
  -    apr_lock_release(pipe_of_death_mutex);
  +    apr_thread_mutex_unlock(pipe_of_death_mutex);
   }
   
   static void *listener_thread(apr_thread_t *thd, void * dummy)
  @@ -567,9 +568,9 @@
   
       free(ti);
   
  -    apr_lock_acquire(worker_thread_count_mutex);
  +    apr_thread_mutex_lock(worker_thread_count_mutex);
       worker_thread_count++;
  -    apr_lock_release(worker_thread_count_mutex);
  +    apr_thread_mutex_unlock(worker_thread_count_mutex);
   
       apr_poll_setup(&pollset, num_listensocks+1, tpool);
       for(n=0 ; n <= num_listensocks ; ++n)
  @@ -724,9 +725,9 @@
   
       ap_update_child_status(process_slot, thread_slot,
           (dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
  -    apr_lock_acquire(worker_thread_count_mutex);
  +    apr_thread_mutex_lock(worker_thread_count_mutex);
       worker_thread_count--;
  -    apr_lock_release(worker_thread_count_mutex);
  +    apr_thread_mutex_unlock(worker_thread_count_mutex);
   
       apr_thread_exit(thd, APR_SUCCESS);
       return NULL;
  @@ -886,10 +887,10 @@
           clean_child_exit(APEXIT_CHILDFATAL);
       }
       worker_thread_count = 0;
  -    apr_lock_create(&worker_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS,
  -                    NULL, pchild);
  -    apr_lock_create(&pipe_of_death_mutex, APR_MUTEX, APR_INTRAPROCESS, 
  -                    NULL, pchild);
  +    apr_thread_mutex_create(&worker_thread_count_mutex,
  +                            APR_THREAD_MUTEX_DEFAULT, pchild);
  +    apr_thread_mutex_create(&pipe_of_death_mutex,
  +                            APR_THREAD_MUTEX_DEFAULT, pchild);
   
       ts = (thread_starter *)apr_palloc(pchild, sizeof(*ts));
   
  
  
  

Mime
View raw message