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/worker fdqueue.c worker.c
Date Tue, 31 Jul 2001 15:35:28 GMT
rbb         01/07/31 08:35:28

  Modified:    server/mpm/worker fdqueue.c worker.c
  Log:
  It helps if we broadcast to the workers that we are trying to shutdown.
  
  Revision  Changes    Path
  1.2       +7 -0      httpd-2.0/server/mpm/worker/fdqueue.c
  
  Index: fdqueue.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/fdqueue.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- fdqueue.c	2001/07/30 05:02:53	1.1
  +++ fdqueue.c	2001/07/31 15:35:28	1.2
  @@ -148,6 +148,7 @@
       if (queue->head == queue->tail) {
           if (block_if_empty) {
               pthread_cond_wait(&queue->not_empty, &queue->one_big_mutex);
  +fprintf(stderr, "Found a non-empty queue  :-)\n");
           }
       } 
       
  @@ -158,4 +159,10 @@
           queue->head = (queue->head + 1) % queue->bounds;
       }
       return APR_SUCCESS;
  +}
  +
  +void ap_queue_signal_all_wakeup(FDQueue *queue)
  +{
  +fprintf(stderr, "trying to broadcast to all workers\n");
  +    pthread_cond_broadcast(&queue->not_empty);
   }
  
  
  
  1.4       +14 -7     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- worker.c	2001/07/31 06:22:32	1.3
  +++ worker.c	2001/07/31 15:35:28	1.4
  @@ -191,6 +191,12 @@
   #define SAFE_ACCEPT(stmt) (stmt)
   #endif
   
  +static signal_workers(void)
  +{
  +    workers_may_exit = 1;
  +    ap_queue_signal_all_wakeup(worker_queue);
  +}
  +
   AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
   {
       switch(query_code){
  @@ -481,7 +487,7 @@
   static void check_infinite_requests(void)
   {
       if (ap_max_requests_per_child) {
  -        workers_may_exit = 1;              
  +        signal_workers();
       }
       else {
           /* wow! if you're executing this code, you may have set a record.
  @@ -502,6 +508,7 @@
   /* Sets workers_may_exit if we received a character on the pipe_of_death */
   static void check_pipe_of_death(void)
   {
  +fprintf(stderr, "looking at pipe of death\n");
       apr_lock_acquire(pipe_of_death_mutex);
       if (!workers_may_exit) {
           apr_status_t ret;
  @@ -516,7 +523,7 @@
           else {
               /* It won the lottery (or something else is very
                * wrong). Embrace death with open arms. */
  -            workers_may_exit = 1;
  +            signal_workers();
           }
       }
       apr_lock_release(pipe_of_death_mutex);
  @@ -564,7 +571,7 @@
               ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                            "apr_lock_acquire failed. Attempting to shutdown "
                            "process gracefully.");
  -            workers_may_exit = 1;
  +            signal_workers();
           }
   
           while (!workers_may_exit) {
  @@ -581,7 +588,7 @@
                    * circumstances. Let's try exiting gracefully, for now. */
                   ap_log_error(APLOG_MARK, APLOG_ERR, ret, (const server_rec *)
                                ap_server_conf, "apr_poll: (listen)");
  -                workers_may_exit = 1;
  +                signal_workers();
               }
   
               if (workers_may_exit) break;
  @@ -628,7 +635,7 @@
                   ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                                "apr_lock_release failed. Attempting to shutdown "
                                "process gracefully.");
  -                workers_may_exit = 1;
  +                signal_workers();
               }
               if (csd != NULL) {
                   ap_queue_push(worker_queue, csd, ptrans);
  @@ -641,7 +648,7 @@
                   ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                                "apr_lock_release failed. Attempting to shutdown "
                                "process gracefully.");
  -                workers_may_exit = 1;
  +                signal_workers();
               }
               break;
           }
  @@ -885,7 +892,7 @@
   
       apr_signal_thread(check_signal);
   
  -    workers_may_exit = 1;   /* helps us terminate a little more quickly when 
  +    signal_workers();       /* helps us terminate a little more quickly when 
                                * the dispatch of the signal thread
                                * beats the Pipe of Death and the browsers
                                */
  
  
  

Mime
View raw message