httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-apr/pthreads/src/main http_main.c
Date Mon, 22 Mar 1999 20:10:43 GMT
rbb         99/03/22 12:10:42

  Modified:    pthreads/src/main http_main.c
  Log:
  Small abstraction patch.  This also closes a small hole.  We want to kill
  accept threads before we kill worker threads.
  
  Revision  Changes    Path
  1.65      +29 -8     apache-apr/pthreads/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- http_main.c	1999/03/21 10:51:43	1.64
  +++ http_main.c	1999/03/22 20:10:41	1.65
  @@ -409,15 +409,25 @@
       exit(code);
   }
   
  -void graceful_killer(void)
  -{
  -    listen_rec *lr;
  -    int i;
  -    int index = find_child_by_pid(getpid());
  -    parent_score *ss = &ap_scoreboard_image->parent[index];
  +/* Kill off any worker threads by kicking them out of whatever they are doing
  + * and allowing them to see that requests_this_child == 0.
  + * It is possible this function could be defined to be NULL in some accept
  + * models.
  + */
   
  +void kill_workers(void)
  +{
       pthread_cond_broadcast(&(csd_queue.not_empty));
  -    
  +}
  +
  +/* Kill off any acceptor threads by kicking them out of what they are doing
  + * and allowing them to see that requests_this_child == 0.
  + * It is possible this function could be defined to be NULL in some accept
  + * models.
  + */
  +void kill_acceptors(void)
  +{
  +    listen_rec *lr;
       /* Kick acceptor threads out of accept */
       
       lr = ap_listeners;
  @@ -428,7 +438,18 @@
   
       /* Kick any acceptor out of blocking on a full queue */
       pthread_cond_broadcast(&(csd_queue.not_full));
  -    
  +}    
  +
  +void graceful_killer(void)
  +{
  +    int i;
  +    int index = find_child_by_pid(getpid());
  +    parent_score *ss = &ap_scoreboard_image->parent[index];
  +
  +    /* The two functions to get all of our other threads to die off. */
  +    kill_acceptors(); 
  +    kill_workers(); 
  +
       for (i = 0; i < ss->worker_threads + ss->acceptor_threads; i++) {
           if (ap_scoreboard_image->servers[index][i].status != SERVER_DEAD) {
   	    pthread_join(ap_scoreboard_image->servers[index][i].tid, NULL);
  
  
  

Mime
View raw message