mirror of
https://github.com/nginx/nginx.git
synced 2024-12-12 10:19:00 +08:00
introduce NGX_PROCESS_JUST_SPAWN and change field name accordingly
This commit is contained in:
parent
fe8726404c
commit
07b280a29f
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user