mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-07 22:21:47 +00:00
use SIGTSTP instead of SIGWINCH for pause/suspend/resume
This commit is contained in:
@@ -19,11 +19,11 @@ void suspend_resume_them_all(int signum) {
|
||||
int suspend = 0;
|
||||
|
||||
if (uwsgi.workers[0].suspended == 1) {
|
||||
uwsgi_log_verbose("*** (SIGWINCH received) resuming workers ***\n");
|
||||
uwsgi_log_verbose("*** (SIGTSTP received) resuming workers ***\n");
|
||||
uwsgi.workers[0].suspended = 0;
|
||||
}
|
||||
else {
|
||||
uwsgi_log_verbose("*** PAUSE (press start to resume, if you do not have a joypad send SIGWINCH) ***\n");
|
||||
uwsgi_log_verbose("*** PAUSE (press start to resume, if you do not have a joypad send SIGTSTP) ***\n");
|
||||
suspend = 1;
|
||||
uwsgi.workers[0].suspended = 1;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ void suspend_resume_them_all(int signum) {
|
||||
for(i=1;i<=uwsgi.numproc;i++) {
|
||||
uwsgi.workers[i].suspended = suspend;
|
||||
if (uwsgi.workers[i].pid > 0) {
|
||||
if (kill(uwsgi.workers[i].pid, SIGWINCH)) {
|
||||
if (kill(uwsgi.workers[i].pid, SIGTSTP)) {
|
||||
uwsgi_error("kill()");
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ int master_loop(char **argv, char **environ) {
|
||||
|
||||
uwsgi.current_time = time(NULL);
|
||||
|
||||
uwsgi_unix_signal(SIGWINCH, suspend_resume_them_all);
|
||||
uwsgi_unix_signal(SIGTSTP, suspend_resume_them_all);
|
||||
uwsgi_unix_signal(SIGHUP, grace_them_all);
|
||||
if (uwsgi.die_on_term) {
|
||||
uwsgi_unix_signal(SIGTERM, kill_them_all);
|
||||
|
||||
@@ -96,6 +96,7 @@ int uwsgi_respawn_worker(int wid) {
|
||||
|
||||
if (pid == 0) {
|
||||
signal(SIGWINCH, worker_wakeup);
|
||||
signal(SIGTSTP, worker_wakeup);
|
||||
uwsgi.mywid = wid;
|
||||
uwsgi.mypid = getpid();
|
||||
uwsgi.workers[uwsgi.mywid].pid = uwsgi.mypid;
|
||||
|
||||
@@ -752,7 +752,7 @@ void wsgi_req_setup(struct wsgi_request *wsgi_req, int async_id, struct uwsgi_so
|
||||
if (uwsgi.workers[uwsgi.mywid].suspended == 1) {
|
||||
uwsgi_log_verbose("*** worker %d suspended ***\n", uwsgi.mywid);
|
||||
cycle:
|
||||
// wait for some signal (normally SIGWINCH) or 10 seconds (as fallback)
|
||||
// wait for some signal (normally SIGTSTP) or 10 seconds (as fallback)
|
||||
(void) poll(NULL, 0, 10*1000);
|
||||
if (uwsgi.workers[uwsgi.mywid].suspended == 1) goto cycle;
|
||||
uwsgi_log_verbose("*** worker %d resumed ***\n", uwsgi.mywid);
|
||||
|
||||
@@ -3379,7 +3379,7 @@ static int manage_base_opt(int i, char *optarg) {
|
||||
signal_pidfile(SIGHUP, optarg);
|
||||
exit(0);
|
||||
case LONG_ARGS_PAUSE:
|
||||
signal_pidfile(SIGWINCH, optarg);
|
||||
signal_pidfile(SIGTSTP, optarg);
|
||||
exit(0);
|
||||
case LONG_ARGS_ATTACH_DAEMON:
|
||||
if (uwsgi.startup_daemons_cnt < MAX_DAEMONS) {
|
||||
|
||||
Reference in New Issue
Block a user