moonbridge
diff reference.txt @ 278:d4c82c90d244
Make moonbridge_io.signalsocket(...) return a new socket each time it is called
author | jbe |
---|---|
date | Tue Jun 06 20:01:29 2017 +0200 (2017-06-06) |
parents | 928473f7df96 |
children | 1a4f89f4c712 |
line diff
1.1 --- a/reference.txt Tue Jun 06 18:00:30 2017 +0200 1.2 +++ b/reference.txt Tue Jun 06 20:01:29 2017 +0200 1.3 @@ -396,16 +396,18 @@ 1.4 number (e.g. 9 or 15, respectively). 1.5 1.6 1.7 -### moonbridge_io.signalsocket(signal1, signal2, ...) 1.8 +### moonbridge_io.signalsocket(signal) 1.9 + 1.10 +This function installs a signal handler. As argument, either the signal number 1.11 +is passed (e.g. 15) or a name (e.g. "TERM"). 1.12 1.13 -This function installs a signal handler for the signals with the numbers passed 1.14 -as arguments and returns a socket which receives a byte for each received 1.15 -signal. Optionally, a string may be used instead of the signal number (e.g. 1.16 -"KILL" instead of 9, or "TERM" instead of 15). 1.17 +The function returns a new socket object that receives a character (".") each 1.18 +time a signal is received. 1.19 1.20 -Subsequent calls of this function can extend the set of signals but will always 1.21 -return the same socket. If the socket is closed, it is no longer possible to 1.22 -detect signals until the process is terminated. 1.23 +Note that each socket object has an independent buffer. It is thus recommended 1.24 +to always read all bytes, e.g. by using the expression: 1.25 + 1.26 +#(assert(sigsock:read_nb())) > 0 -- true if signal occurred 1.27 1.28 1.29 ### moonbridge_io.tcpconnect(hostname, port)