diff src/os/unix/ngx_process_cycle.c @ 120:e85dca77c46a NGINX_0_3_7

nginx 0.3.7 *) Feature: the "access_log" supports the "buffer=" parameter. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc и ppc; bug appeared in 0.3.2.
author Igor Sysoev <http://sysoev.ru>
date Thu, 27 Oct 2005 00:00:00 +0400
parents 408f195b3482
children d25a1d6034f1
line wrap: on
line diff
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -276,6 +276,13 @@ ngx_single_process_cycle(ngx_cycle_t *cy
         ngx_process_events_and_timers(cycle);
 
         if (ngx_terminate || ngx_quit) {
+
+            for (i = 0; ngx_modules[i]; i++) {
+                if (ngx_modules[i]->exit_process) {
+                    ngx_modules[i]->exit_process(cycle);
+                }
+            }
+
             ngx_master_exit(cycle);
         }
 
@@ -623,10 +630,18 @@ ngx_reap_childs(ngx_cycle_t *cycle)
 static void
 ngx_master_exit(ngx_cycle_t *cycle)
 {
+    ngx_uint_t  i;
+
     ngx_delete_pidfile(cycle);
 
     ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "exit");
 
+    for (i = 0; ngx_modules[i]; i++) {
+        if (ngx_modules[i]->exit_master) {
+            ngx_modules[i]->exit_master(cycle);
+        }
+    }
+
     /*
      * we do not destroy cycle->pool here because a signal handler
      * that uses cycle->log can be called at this point
@@ -735,6 +750,12 @@ ngx_worker_process_cycle(ngx_cycle_t *cy
             ngx_wakeup_worker_threads(cycle);
 #endif
 
+            for (i = 0; ngx_modules[i]; i++) {
+                if (ngx_modules[i]->exit_process) {
+                    ngx_modules[i]->exit_process(cycle);
+                }
+            }
+
             c = cycle->connections;
             for (i = 0; i < cycle->connection_n; i++) {
                 if (c[i].fd != -1