Klaus Demo nginx / 1356622
destroy ngx_cycle->pool on exit Igor Sysoev 14 years ago
1 changed file(s) with 31 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
6161 static u_char master_process[] = "master process";
6262
6363
64 static ngx_cycle_t ngx_exit_cycle;
65 static ngx_log_t ngx_exit_log;
66 static ngx_open_file_t ngx_exit_log_file;
67
68
6469 void
6570 ngx_master_process_cycle(ngx_cycle_t *cycle)
6671 {
648653 }
649654
650655 /*
651 * we do not destroy cycle->pool here because a signal handler
652 * that uses cycle->log can be called at this point
656 * Copy ngx_cycle->log related data to the special static exit cycle,
657 * log, and log file structures enough to allow a signal handler to log.
658 * The handler may be called when standard ngx_cycle->log allocated from
659 * ngx_cycle->pool is already destroyed.
653660 */
654661
655 #if 0
662 ngx_exit_log_file.fd = ngx_cycle->log->file->fd;
663
664 ngx_exit_log = *ngx_cycle->log;
665 ngx_exit_log.file = &ngx_exit_log_file;
666
667 ngx_exit_cycle.log = &ngx_exit_log;
668 ngx_cycle = &ngx_exit_cycle;
669
656670 ngx_destroy_pool(cycle->pool);
657 #endif
658671
659672 exit(0);
660673 }
9951008 }
9961009
9971010 /*
998 * we do not destroy cycle->pool here because a signal handler
999 * that uses cycle->log can be called at this point
1011 * Copy ngx_cycle->log related data to the special static exit cycle,
1012 * log, and log file structures enough to allow a signal handler to log.
1013 * The handler may be called when standard ngx_cycle->log allocated from
1014 * ngx_cycle->pool is already destroyed.
10001015 */
10011016
1002 #if 0
1017 ngx_exit_log_file.fd = ngx_cycle->log->file->fd;
1018
1019 ngx_exit_log = *ngx_cycle->log;
1020 ngx_exit_log.file = &ngx_exit_log_file;
1021
1022 ngx_exit_cycle.log = &ngx_exit_log;
1023 ngx_cycle = &ngx_exit_cycle;
1024
10031025 ngx_destroy_pool(cycle->pool);
1004 #endif
1026
1027 ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "exit");
10051028
10061029 exit(0);
10071030 }