[Qt-interest] No POSIX Signals in Windows; How To Capture Program Termination
Andreas Pakulat
apaku at gmx.de
Tue Nov 23 20:01:18 CET 2010
On 23.11.10 12:45:39, William Gordon Rutherdale (rutherw) wrote:
> Hi.
>
> I have written a program using QCoreApplication that I want to work
> portably across both Linux and Windows.
>
> I added a feature to print information such as statistics when the
> program terminates. I got this working in Linux by creating a handler
> for SIGINT/SIGTERM/SIGHUP that posts an event.
>
> Now, when I moved the source code to my Qt installation in Windows, I
> couldn't get it to compile. Qt sits on top of mingw, which apparently
> doesn't support POSIX process semantics. So the compile-time error I
> got right away was that SIGHUP is an undefined symbol.
>
> My question: How can I write Qt code that detects imminent shutdown in
> a similar fashion in Windows?
You can't, or rather Qt doesn't provide any abstraction for this. Your
only option is to look into Windows native API and find out what option
you have for such cases.
Andreas
--
Executive ability is prominent in your make-up.
More information about the Qt-interest-old
mailing list