?? xh.cpp
字號:
#include <stdio.h>#include <signal.h>#include <sys/types.h>#include <unistd.h>int receivd_signal=0;void catch_ctrl_c(int signo){ printf("signo=%d\n",signo); receivd_signal=1;}main(){ sigset_t newmask; struct sigaction action; action.sa_handler=catch_ctrl_c; action.sa_flags=0; if(sigaction(SIGINT,&action,NULL)==-1) perror("can not SIGINT"); sigprocmask(SIG_SETMASK,NULL,&newmask); sigaddset(&newmask,SIGINT); sigprocmask(SIG_BLOCK,&newmask,NULL); sigdelset(&newmask,SIGINT); //while(receivd_signal==0) sigsuspend(&newmask); printf("dddddddd\n");}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -