moonbridge
diff reference.txt @ 284:28aab22e68b6
New implementation of SIGTERM handling
author | jbe |
---|---|
date | Sun Jun 11 00:02:43 2017 +0200 (2017-06-11) |
parents | 6bb191b6ead5 |
children | a7395fb91ec3 |
line diff
1.1 --- a/reference.txt Fri Jun 09 18:33:57 2017 +0200 1.2 +++ b/reference.txt Sun Jun 11 00:02:43 2017 +0200 1.3 @@ -377,7 +377,7 @@ 1.4 nil (as first return value) plus an error message (as second return value). 1.5 1.6 1.7 -### moonbridge_io.poll(input_set, output_set, timeout) 1.8 +### moonbridge_io.poll(input_set, output_set, timeout, wakeup_on_sigterm) 1.9 1.10 This function waits for at least one of the given file descriptors and/or 1.11 I/O handles to be ready for input or output. The two sets of file descriptors 1.12 @@ -385,9 +385,15 @@ 1.13 which does evaluate to true, e.g. input_set = {[socketA] = true}. If a set is 1.14 nil, it is treated as being empty. 1.15 1.16 +Returns false (plus a notice as second return value) in case of timeout. If the 1.17 +4th parameter is set to true, also returns false (plus a notice) when a SIGTERM 1.18 +has been received since a corresponding signal handler has been installed with 1.19 +moonbridge_io.sigterm_setup(). 1.20 + 1.21 Returns true when at least one file descriptor or handle is ready for reading 1.22 -or writing respectively, or if a signal has been received during waiting. 1.23 -Returns false (plus a notice as second return value) in case of timeout. 1.24 +or writing respectively. The function may also return true if signals have been 1.25 +received during waiting (unless the 4th parameter is set to true and a SIGTERM 1.26 +was received). 1.27 1.28 1.29 ### moonbridge_io.signals 1.30 @@ -396,17 +402,19 @@ 1.31 number (e.g. 9 or 15, respectively). 1.32 1.33 1.34 -### moonbridge_io.signalsocket(signal) 1.35 +### moonbridge_io.sigterm_received() 1.36 1.37 -This function installs a signal handler. As argument, either the signal number 1.38 -is passed (e.g. 15) or a name (e.g. "TERM"). The function returns a socket 1.39 -object that receives a character (".") each time a signal is received. 1.40 +Returns true if a SIGTERM was received after moonbridge_io.sigterm_setup() has 1.41 +installed a corresponding signal handler. The function will then always return 1.42 +true until the process terminates. 1.43 + 1.44 1.45 -The function can be called multiple times, in which case the same socket object 1.46 -is returned. The returned socket should never be closed by the caller. 1.47 +### moonbridge_io.sigterm_setup() 1.48 1.49 -The process should not be forked after calling this function (except for 1.50 -replacing the process with another program). 1.51 +This function installs a signal handler for SIGTERM. Use the function 1.52 +moonbridge_io.sigterm_received() to check whether the signal has been received. 1.53 +In addition, moonbridge_io.poll(...) will wakeup prematurely if the 1.54 +4th parameter is set to true. 1.55 1.56 1.57 ### moonbridge_io.tcpconnect(hostname, port)