标签:
void catch_Signal(int Sign) { switch (Sign) { case SIGINT: printf("SIGINT Signal\n"); exit(0); case SIGUSR1: printf("SIGUSR1 Signal\n"); } } int main(int arg, char *args[]) { signal(SIGINT, catch_Signal); signal(SIGUSR1, catch_Signal); printf("pid = %d\n", getpid()); while(1) { sleep(1); } return 0; }
int main(int arg, char *args[]) { if (arg > 1) { kill(atoi(args[1]), SIGUSR1); printf("sent to %d\n", atoi(args[1])); } return 0; }
标签:
原文地址:http://www.cnblogs.com/shichuan/p/4496341.html