You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@apache.org on 2002/04/13 09:00:32 UTC

cvs commit: httpd-2.0/server/mpm/experimental/leader leader.c

brianp      02/04/13 00:00:32

  Modified:    server/mpm/experimental/leader leader.c
  Log:
  Fixed the shutdown logic
  
  Revision  Changes    Path
  1.4       +20 -15    httpd-2.0/server/mpm/experimental/leader/leader.c
  
  Index: leader.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/leader/leader.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- leader.c	12 Apr 2002 04:24:44 -0000	1.3
  +++ leader.c	13 Apr 2002 07:00:32 -0000	1.4
  @@ -844,13 +844,9 @@
       got_fd:
           if (!workers_may_exit) {
               rv = lr->accept_func(&csd, lr, ptrans);
  +            /* later we trash rv and rely on csd to indicate success/failure */
  +            AP_DEBUG_ASSERT(rv == APR_SUCCESS || !csd);
   
  -            /* If we were interrupted for whatever reason, just start
  -             * the main loop over again.
  -             */
  -            if (APR_STATUS_IS_EINTR(rv)) {
  -                continue;
  -            }
               if (rv == APR_EGENERAL) {
                   /* E[NM]FILE, ENOMEM, etc */
                   resource_shortage = 1;
  @@ -1178,17 +1174,26 @@
                       break;
                   }
               }
  +            if (rv == AP_GRACEFUL || rv == AP_RESTART) {
  +                /* make sure the start thread has finished; 
  +                 * signal_threads() and join_workers depend on that
  +                 */
  +                join_start_thread(start_thread_id);
  +                signal_threads(rv == AP_GRACEFUL ? ST_GRACEFUL : ST_UNGRACEFUL);
  +                break;
  +            }
           }
   
  -        signal_threads(ST_GRACEFUL);
  -        /* A terminating signal was received. Now join each of the
  -         * workers to clean them up.
  -         *   If the worker already exited, then the join frees
  -         *   their resources and returns.
  -         *   If the worker hasn't exited, then this blocks until
  -         *   they have (then cleans up).
  -         */
  -        join_workers(threads);
  +        if (rv == AP_GRACEFUL) {
  +            /* A terminating signal was received. Now join each of the
  +             * workers to clean them up.
  +             *   If the worker already exited, then the join frees
  +             *   their resources and returns.
  +             *   If the worker hasn't exited, then this blocks until
  +             *   they have (then cleans up).
  +             */
  +            join_workers(threads);
  +        }
       }
   
       free(threads);