win32 signal

Remarks
 

The signal function enables a process to choose one of several ways to handle an interrupt signal from the operating system. The sig argument is the interrupt to which signal responds; it must be one of the following manifest constants, which are defined in SIGNAL.H.

 

sig value

Description

SIGABRT

Abnormal termination

SIGFPE

Floating-point error

SIGILL

Illegal instruction

SIGINT

CTRL+C signal

SIGSEGV

Illegal storage access

SIGTERM

Termination request

If sig is not one of the above values, the invalid parameter handler is invoked, as defined in Parameter Validation . If execution is allowed to continue, this function sets errno to EINVALand returns SIG_ERR.

By default, signal terminates the calling program with exit code 3, regardless of the value of sig.

 

Example :

win32 signal

int main(void)
{    

    typedef void (*SignalHandlerPointer)(int);

    SignalHandlerPointer previousHandler;
    previousHandler = signal(SIGABRT, SignalHandler);
    previousHandler = signal(SIGINT, SignalHandler);
    previousHandler = signal(SIGTERM, SignalHandler);
    previousHandler = signal(SIGBREAK, SignalHandler);

    //abort();
    while (1)
    {
        Sleep(100);
    }
win32 signal
win32 signal
void SignalHandler(int signal)
{
    if (signal == SIGABRT)
    {
        // abort signal handler code
    } else 
    {
        // ...
    }

    printf("____ signal: %d  \n", signal);
}
win32 signal

 

http://msdn.microsoft.com/en-us/library/xdkz3x12.aspx

 

Send signal

win32 signal,布布扣,bubuko.com

win32 signal

上一篇:Windows Driver Kit Version 7.1.0 ( 也就是 7600.16385.1 ) 下载地址


下一篇:Win8 IIS 安装和部署网站问题