?? test10_6.txt
字號:
#include <signal.h>
#include "ourhdr.h"
volatile sig_atomic_t quitflag;
int main(void)
{
void sig_int(int);
sigset_t newmask, oldmask, zeromask;
if(signal(SIGINT,sig_int)==SIG_ERR)
err_sys("signal (SIGINT) error");
if(signal(SIGQUIT,sig_int)==SIG_ERR)
err_sys("signal (SIGQUIT) error");
sigemptyset(&zeromask);
sigemptyset(&newmask);
sigaddset(&newmask, SIGQUIT);
if(sigprocmask(SIG_BLOCK,&newmask,&oldmask)<0)
err_sys("SIG_BLOCK error");
while(quitflag==0)
sigsuspend(&zeromask);
quitflag=0;
if(sigprocmask(SIG_SETMASK,&oldmask,NULL)<0)
exit(0);
}
void sig_int(int signumber)
{
if(signumber==SIGINT)
printf("\nintetrreupt\n");
else if(signumber==SIGQUIT)
quitflag=1;
return;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -