- catch signal in win32 programming
- Posted by spleen2060@gmail.com on May 12th, 2008
hi all,
there's a way to do this in win32 programming (C/C++)
#include <signal.h>
void cleanAll()
{
sig = 1;
}
int main(int argc, char **argv)
{
signal(SIGINT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGQUIT, cleanup);
signal(SIGHUP, cleanup);
while (feof(fpin) == 0 && sig == 0)
{
....
}
}
- Posted by Sebastian G. on May 12th, 2008
spleen2060@gmail.com wrote:
Not exactly. As you can easily look up in signal.h, neither SIGQUIT nor
SIGHUB are supported by the Win32 subsystem. Though it would be possibly
adding such asynchronous callbacks with support from a device driver, as has
been demonstrated. Also your prototype for the signal handler is wrong, it
should be "void func(int)". And you should include stdlib.h for the feof()
macro.
- Posted by spleen2060@gmail.com on May 12th, 2008
On May 12, 12:41 pm, "Sebastian G." <se...@seppig.de> wrote:
where I can look to find this?
my objective it's to cathc a kill (pskill) of a process
thanks for now ..
yes ... it's only a cut and paste ...
- Posted by Sebastian G. on May 12th, 2008
spleen2060@gmail.com wrote:
D'Oh! First hit on Google!
<http://www.google.com/search?q=POSIX+signals+Windows+driver&hl=en&safe=o ff>
This is typically catched by the CRT and handled by _onexit(), as ANSI
compatibility requires. Except if it was done by TerminateProces or
TerminateThread, which you can't catch (and shouldn't attempt to).