introduce NGX_PROCESS_JUST_SPAWN and change field name accordingly

This commit is contained in:
Igor Sysoev 2009-08-10 13:07:15 +00:00
parent fe8726404c
commit 07b280a29f
6 changed files with 31 additions and 18 deletions

View File

@ -214,21 +214,33 @@ ngx_spawn_process(ngx_cycle_t *cycle, ngx_spawn_proc_pt proc, void *data,
switch (respawn) {
case NGX_PROCESS_NORESPAWN:
ngx_processes[s].respawn = 0;
ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_JUST_SPAWN:
ngx_processes[s].respawn = 0;
ngx_processes[s].just_spawn = 1;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_RESPAWN:
ngx_processes[s].respawn = 1;
ngx_processes[s].just_respawn = 0;
ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_JUST_RESPAWN:
ngx_processes[s].respawn = 1;
ngx_processes[s].just_respawn = 1;
ngx_processes[s].just_spawn = 1;
ngx_processes[s].detached = 0;
break;
case NGX_PROCESS_DETACHED:
ngx_processes[s].respawn = 0;
ngx_processes[s].just_respawn = 0;
ngx_processes[s].just_spawn = 0;
ngx_processes[s].detached = 1;
break;
}

View File

@ -27,7 +27,7 @@ typedef struct {
char *name;
unsigned respawn:1;
unsigned just_respawn:1;
unsigned just_spawn:1;
unsigned detached:1;
unsigned exiting:1;
unsigned exited:1;
@ -45,9 +45,10 @@ typedef struct {
#define NGX_MAX_PROCESSES 1024
#define NGX_PROCESS_NORESPAWN -1
#define NGX_PROCESS_RESPAWN -2
#define NGX_PROCESS_JUST_RESPAWN -3
#define NGX_PROCESS_DETACHED -4
#define NGX_PROCESS_JUST_SPAWN -2
#define NGX_PROCESS_RESPAWN -3
#define NGX_PROCESS_JUST_RESPAWN -4
#define NGX_PROCESS_DETACHED -5
#define ngx_getpid getpid

View File

@ -456,14 +456,14 @@ ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
ngx_processes[i].exited,
ngx_processes[i].detached,
ngx_processes[i].respawn,
ngx_processes[i].just_respawn);
ngx_processes[i].just_spawn);
if (ngx_processes[i].detached || ngx_processes[i].pid == -1) {
continue;
}
if (ngx_processes[i].just_respawn) {
ngx_processes[i].just_respawn = 0;
if (ngx_processes[i].just_spawn) {
ngx_processes[i].just_spawn = 0;
continue;
}
@ -533,7 +533,7 @@ ngx_reap_children(ngx_cycle_t *cycle)
ngx_processes[i].exited,
ngx_processes[i].detached,
ngx_processes[i].respawn,
ngx_processes[i].just_respawn);
ngx_processes[i].just_spawn);
if (ngx_processes[i].pid == -1) {
continue;

View File

@ -163,11 +163,11 @@ ngx_spawn_process(ngx_cycle_t *cycle, char *name, ngx_int_t respawn)
switch (respawn) {
case NGX_PROCESS_RESPAWN:
ngx_processes[s].just_respawn = 0;
ngx_processes[s].just_spawn = 0;
break;
case NGX_PROCESS_JUST_RESPAWN:
ngx_processes[s].just_respawn = 1;
ngx_processes[s].just_spawn = 1;
break;
}

View File

@ -33,7 +33,7 @@ typedef struct {
u_char quit_event[NGX_PROCESS_SYNC_NAME];
u_char reopen_event[NGX_PROCESS_SYNC_NAME];
unsigned just_respawn:1;
unsigned just_spawn:1;
unsigned exiting:1;
} ngx_process_t;

View File

@ -440,10 +440,10 @@ ngx_quit_worker_processes(ngx_cycle_t *cycle, ngx_uint_t old)
ngx_processes[n].pid,
ngx_processes[n].handle,
ngx_processes[n].exiting,
ngx_processes[n].just_respawn);
ngx_processes[n].just_spawn);
if (old && ngx_processes[n].just_respawn) {
ngx_processes[n].just_respawn = 0;
if (old && ngx_processes[n].just_spawn) {
ngx_processes[n].just_spawn = 0;
continue;
}
@ -550,7 +550,7 @@ found:
ngx_processes[n].pid,
ngx_processes[n].handle,
ngx_processes[n].exiting,
ngx_processes[n].just_respawn);
ngx_processes[n].just_spawn);
if (ngx_processes[n].handle) {
return 1;