Using SIGINT

前端 未结 6 1934
误落风尘
误落风尘 2020-12-18 15:24

According to this http://www.cplusplus.com/reference/clibrary/csignal/signal.html

SIGINT is generally used/cause by the user. How do i cause a SIG

6条回答
  •  盖世英雄少女心
    2020-12-18 16:01

    C89 and C99 define raise() in signal.h:

    #include 
    
    int raise(int sig);
    

    This function sends a signal to the calling process, and is equivalent to

    kill(getpid(), sig);
    

    If the platform supports threads, then the call is equivalent to

    pthread_kill(pthread_self(), sig);
    

    The return value is 0 on success, nonzero otherwise.

提交回复
热议问题