|
|
@ -881,7 +881,7 @@ static void cancel_pthread(pthread_t *pth) |
|
|
|
pth = NULL; |
|
|
|
pth = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void __shutdown_children(ckpool_t *ckp, int sig) |
|
|
|
static void __shutdown_children(ckpool_t *ckp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
@ -894,15 +894,15 @@ static void __shutdown_children(ckpool_t *ckp, int sig) |
|
|
|
for (i = 0; i < ckp->proc_instances; i++) { |
|
|
|
for (i = 0; i < ckp->proc_instances; i++) { |
|
|
|
pid_t pid = ckp->children[i]->pid; |
|
|
|
pid_t pid = ckp->children[i]->pid; |
|
|
|
if (!kill_pid(pid, 0)) |
|
|
|
if (!kill_pid(pid, 0)) |
|
|
|
kill_pid(pid, sig); |
|
|
|
kill_pid(pid, SIGUSR1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void shutdown_children(ckpool_t *ckp, int sig) |
|
|
|
static void shutdown_children(ckpool_t *ckp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
cancel_join_pthread(&ckp->pth_watchdog); |
|
|
|
cancel_join_pthread(&ckp->pth_watchdog); |
|
|
|
|
|
|
|
|
|
|
|
__shutdown_children(ckp, sig); |
|
|
|
__shutdown_children(ckp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void sighandler(int sig) |
|
|
|
static void sighandler(int sig) |
|
|
@ -915,10 +915,7 @@ static void sighandler(int sig) |
|
|
|
ckp->name, sig); |
|
|
|
ckp->name, sig); |
|
|
|
cancel_join_pthread(&ckp->pth_watchdog); |
|
|
|
cancel_join_pthread(&ckp->pth_watchdog); |
|
|
|
|
|
|
|
|
|
|
|
__shutdown_children(ckp, SIGUSR1); |
|
|
|
__shutdown_children(ckp); |
|
|
|
/* Wait, then send SIGKILL */ |
|
|
|
|
|
|
|
cksleep_ms(100); |
|
|
|
|
|
|
|
__shutdown_children(ckp, SIGKILL); |
|
|
|
|
|
|
|
cancel_pthread(&ckp->pth_listener); |
|
|
|
cancel_pthread(&ckp->pth_listener); |
|
|
|
exit(0); |
|
|
|
exit(0); |
|
|
|
} |
|
|
|
} |
|
|
@ -1516,7 +1513,7 @@ int main(int argc, char **argv) |
|
|
|
if (ckp.pth_listener) |
|
|
|
if (ckp.pth_listener) |
|
|
|
join_pthread(ckp.pth_listener); |
|
|
|
join_pthread(ckp.pth_listener); |
|
|
|
|
|
|
|
|
|
|
|
shutdown_children(&ckp, SIGTERM); |
|
|
|
shutdown_children(&ckp); |
|
|
|
clean_up(&ckp); |
|
|
|
clean_up(&ckp); |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|