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

René J. V. Bertin rjvbertin at gmail.com
Sat Oct 13 17:21:17 CEST 2018


So I think I have an alternative implementation that ought to be more 
straightforward to port to MS Windows if ever that is necessary, one that I 
think (hope) is safe:

https://github.com/RJVB/shortcut-test-qt5/blob/master/main.cpp#L96

This uses a single semaphore and a QtConcurrent background thread that 
"monitors" it. I think it's hardly more complex than using the 
pipe+QSocketNotifier solution (and could be simpler if it weren't apparently a 
good idea to destroy the semaphore before exiting).

Curiously, the manpage suggest that sem_wait() should be interrupted by a 
signal, and that's indeed the case in a single-threaded test-case. Pity, because 
it would have made the call to sem_post() superfluous in the actual signal 
handler...

R.




More information about the Interest mailing list