2012. 7. 13. 16:27

#include <stdio.h>
#include <signal.h>
#include <unistd.h>

main()
{
    int count=0;

    /* SIGINT 시그널 받으면 무시하도록 설정 */
    signal(SIGINT, SIG_IGN);
    while (1) {
       printf("Hello World\n");
       sleep(1);
       if (++count == 5)   /* count가 5가 되면 */
          /* SIGINT 시그널 받으면 시스템에서 기본적으로 설정한 동작을 하도록 설정 */
          signal(SIGINT, SIG_DFL);
    }
}

'EMBEDDED > SYSTEM Proc' 카테고리의 다른 글

[Signal] kill() 관련예제  (0) 2012.07.13
[Signal] sigaction()함수에 관한 예제  (0) 2012.07.13
[Signal] signal()에 관한 예제  (0) 2012.07.13
[Signal] sleep()에 관한 예제  (0) 2012.07.13
[Signal] sigpipe()관련 예제  (0) 2012.07.13
Posted by 몰라욧