comparison src/os/unix/ngx_process_cycle.c @ 300:502b03d9d2a3

nginx-0.0.3-2004-03-31-00:31:58 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 30 Mar 2004 20:31:58 +0000
parents ec3c049681fd
children 744965ec6275
comparison
equal deleted inserted replaced
299:46b7eeb8a116 300:502b03d9d2a3
66 live = 0; 66 live = 0;
67 67
68 for ( ;; ) { 68 for ( ;; ) {
69 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "new cycle"); 69 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "new cycle");
70 70
71 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx,
72 ngx_core_module);
73
71 if (ngx_process == NGX_PROCESS_MASTER) { 74 if (ngx_process == NGX_PROCESS_MASTER) {
72 ngx_spawn_process(cycle, ngx_worker_process_cycle, NULL, 75 for (i = 0; i < (ngx_uint_t) ccf->worker_processes; i++) {
73 "worker process", NGX_PROCESS_RESPAWN); 76 ngx_spawn_process(cycle, ngx_worker_process_cycle, NULL,
77 "worker process", NGX_PROCESS_RESPAWN);
78 }
74 79
75 /* 80 /*
76 * we have to limit the maximum life time of the worker processes 81 * we have to limit the maximum life time of the worker processes
77 * by 1 month because our millisecond event timer is limited 82 * by 1 month because our millisecond event timer is limited
78 * by 49 days on 32-bit platforms 83 * by 49 days on 32-bit platforms
101 } 106 }
102 } 107 }
103 } 108 }
104 } 109 }
105 110
106 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx,
107 ngx_core_module);
108 111
109 /* a cycle with the same configuration because a new one is invalid */ 112 /* a cycle with the same configuration because a new one is invalid */
110 113
111 for ( ;; ) { 114 for ( ;; ) {
112 115
251 "reconfiguring"); 254 "reconfiguring");
252 } 255 }
253 256
254 if (ngx_reopen) { 257 if (ngx_reopen) {
255 if (ngx_process == NGX_PROCESS_MASTER) { 258 if (ngx_process == NGX_PROCESS_MASTER) {
256 if (ccf->worker_reopen != 0) { 259 signo = ngx_signal_value(NGX_REOPEN_SIGNAL);
257 signo = ngx_signal_value(NGX_REOPEN_SIGNAL); 260 ngx_reopen = 0;
258 ngx_reopen = 0;
259
260 } else if (ngx_noaccept) {
261 ngx_reopen = 0;
262
263 } else {
264 signo = ngx_signal_value(NGX_SHUTDOWN_SIGNAL);
265 }
266 261
267 } else { /* NGX_PROCESS_SINGLE */ 262 } else { /* NGX_PROCESS_SINGLE */
268 ngx_reopen = 0; 263 ngx_reopen = 0;
269 } 264 }
270 265
271 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, 266 ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
272 "reopening logs"); 267 "reopening logs");
273 ngx_reopen_files(cycle, 268 ngx_reopen_files(cycle, ccf->user);
274 ccf->worker_reopen != 0 ? ccf->user : (uid_t) -1);
275 } 269 }
276 } 270 }
277 271
278 if (signo) { 272 if (signo) {
279 for (i = 0; i < ngx_last_process; i++) { 273 for (i = 0; i < ngx_last_process; i++) {