moonbridge
changeset 269:694446c1316b
Use SIGTERM to terminate child processes gracefully
author | jbe |
---|---|
date | Sun Jun 04 19:23:31 2017 +0200 (2017-06-04) |
parents | d6de7502df31 |
children | fab22173abc8 |
files | moonbridge.c |
line diff
1.1 --- a/moonbridge.c Sun Jun 04 18:30:13 2017 +0200 1.2 +++ b/moonbridge.c Sun Jun 04 19:23:31 2017 +0200 1.3 @@ -323,7 +323,6 @@ 1.4 switch (sig) { 1.5 case SIGHUP: 1.6 case SIGINT: 1.7 - case SIGTERM: 1.8 kill(moonbr_masterpid, sig); 1.9 } 1.10 } 1.11 @@ -337,7 +336,6 @@ 1.12 signal(SIGINT, moonbr_signal); 1.13 signal(SIGTERM, moonbr_signal); 1.14 signal(SIGCHLD, moonbr_signal); 1.15 - /* signal(SIGUSR1, moonbr_signal); */ /* might be used to terminate children gracefully */ 1.16 } 1.17 1.18 1.19 @@ -1145,16 +1143,13 @@ 1.20 } 1.21 } 1.22 moonbr_poll_shutdown(); /* avoids loops due to error condition when polling closed listeners */ 1.23 - /* sending SIGUSR1 to children might be used to terminate children gracefully */ 1.24 - /* 1.25 { 1.26 pid_t pgrp = getpgrp(); 1.27 - moonbr_log(LOG_INFO, "Sending SIGUSR1 to all processes in group %i", (int)pgrp); 1.28 - if (killpg(pgrp, SIGUSR1)) { 1.29 - moonbr_log(LOG_WARNING, "Error while sending SIGUSR1 to own process group: %s", strerror(errno)); 1.30 + moonbr_log(LOG_INFO, "Sending SIGTERM to all processes in group %i", (int)pgrp); 1.31 + if (killpg(pgrp, SIGTERM)) { 1.32 + moonbr_log(LOG_WARNING, "Error while sending SIGTERM to own process group: %s", strerror(errno)); 1.33 } 1.34 } 1.35 - */ 1.36 } 1.37 1.38