destroy ngx_cycle->pool on exit
Igor Sysoev
14 years ago
61 | 61 | static u_char master_process[] = "master process"; |
62 | 62 | |
63 | 63 | |
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 | ||
64 | 69 | void |
65 | 70 | ngx_master_process_cycle(ngx_cycle_t *cycle) |
66 | 71 | { |
648 | 653 | } |
649 | 654 | |
650 | 655 | /* |
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. | |
653 | 660 | */ |
654 | 661 | |
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 | ||
656 | 670 | ngx_destroy_pool(cycle->pool); |
657 | #endif | |
658 | 671 | |
659 | 672 | exit(0); |
660 | 673 | } |
995 | 1008 | } |
996 | 1009 | |
997 | 1010 | /* |
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. | |
1000 | 1015 | */ |
1001 | 1016 | |
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 | ||
1003 | 1025 | ngx_destroy_pool(cycle->pool); |
1004 | #endif | |
1026 | ||
1027 | ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "exit"); | |
1005 | 1028 | |
1006 | 1029 | exit(0); |
1007 | 1030 | } |