[Interest] proper (silent) exit in response to SIGHUP?

René J. V. Bertin rjvbertin at gmail.com
Fri Oct 12 09:26:44 CEST 2018


Thiago Macieira wrote:

So I got to thinking: how Linux-specific if not exclusive are the guidelines you 
pointed me to (http://man7.org/linux/man-pages/man7/signal-safety.7.html)?

> Open a pipe or an eventfd, then install your signal handler. In that signal
> handler, write anything to the writing end or write uint64_t(1) the eventfd.
> Create a QSocketNotifier on the reading end of the pipe or on the eventfd,

Evenfd is Linux-only AFAIK, and opening 2 file descriptors is relatively costly 
on *BSD (which have like a 256 fd per-process limit) if you also want to use as 
many QFileSystemWatchers as possible.

(There's also MS Windows but I presume its signal handling is completely 
different anyway...)

Finally: why use a QSocketNotifier that sends a signal to a slot, how is that 
different from sending the signal directly from the signal handler function?

Thanks,
R.




More information about the Interest mailing list