aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/common/erl_check_io.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2017-03-21 14:37:03 +0100
committerBjörn-Egil Dahlberg <[email protected]>2017-03-21 14:49:55 +0100
commitf92d862c1af230a873c2b2d30fea575ff3dafd56 (patch)
treede8a3dac88e62cd9ff2820ba7404bf21d1e08903 /erts/emulator/sys/common/erl_check_io.c
parenta748cafdc7063d9f181ba12088db6458793ced2f (diff)
downloadotp-f92d862c1af230a873c2b2d30fea575ff3dafd56.tar.gz
otp-f92d862c1af230a873c2b2d30fea575ff3dafd56.tar.bz2
otp-f92d862c1af230a873c2b2d30fea575ff3dafd56.zip
erts: Make sigterm signal safe for non-smp beam
The signal handler will now schedule a sigterm message instead of sending the message in the signal handler. The signal handler must refrain from memory allocations and thus the event is scheduled.
Diffstat (limited to 'erts/emulator/sys/common/erl_check_io.c')
-rw-r--r--erts/emulator/sys/common/erl_check_io.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/erts/emulator/sys/common/erl_check_io.c b/erts/emulator/sys/common/erl_check_io.c
index 44a77f3ea5..8f2f1f9521 100644
--- a/erts/emulator/sys/common/erl_check_io.c
+++ b/erts/emulator/sys/common/erl_check_io.c
@@ -1617,6 +1617,11 @@ ERTS_CIO_EXPORT(erts_check_io)(int do_wait)
erts_do_break_handling();
#endif
+#ifdef ERTS_SIGNAL_SIGTERM
+ if (ERTS_SIGNAL_SIGTERM)
+ erts_handle_signal_sigterm();
+#endif
+
/* Figure out timeout value */
timeout_time = (do_wait
? erts_check_next_timeout_time(esdp)
@@ -1654,6 +1659,11 @@ ERTS_CIO_EXPORT(erts_check_io)(int do_wait)
erts_do_break_handling();
#endif
+#ifdef ERTS_SIGNAL_SIGTERM
+ if (ERTS_SIGNAL_SIGTERM)
+ erts_handle_signal_sigterm();
+#endif
+
if (poll_ret != 0) {
erts_smp_atomic_set_nob(&pollset.in_poll_wait, 0);
forget_removed(&pollset);