zoukankan      html  css  js  c++  java
  • win32 signal

    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 :

    
    
    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);
        }
    void SignalHandler(int signal)
    {
        if (signal == SIGABRT)
        {
            // abort signal handler code
        } else 
        {
            // ...
        }
    
        printf("____ signal: %d  
    ", signal);
    }

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

    Send signal

  • 相关阅读:
    HDU1205 吃糖果【水题】
    HDU2568 前进【水题】
    架构图初体验
    五层架构
    文件系统权限设计涉及范畴
    微服务
    领域驱动设计
    容器技术Docker
    架构总结
    仓储模式的简单理解
  • 原文地址:https://www.cnblogs.com/iclk/p/3560081.html
Copyright © 2011-2022 走看看