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.

_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to