Home > OS >  Signal under Linux programming problem: why the two different results? Exclude o
Signal under Linux programming problem: why the two different results? Exclude o

Time:09-24

 
# include & lt; Signal. H>
# include & lt; Unistd. H>
# include & lt; stdio.h>

Int main () {
Sigset_t set;
Int count=10;
Sigemptyset (& amp; The set);//to empty all signal collection
Sigaddset (& amp; The set of SIGINT);//add to block signals
Sigprocmask (SIG_BLOCK, & amp; Set to NULL);//set the blocking signal

While (count) {
Printf (" don 't disturb me (% d) \ n ", the count --);
sleep(1);
}
Sigprocmask (SIG_UNBLOCK, & amp; Set to NULL);//unblocked
Sleep (10);
Printf (" you did not disturb me! \ n ");
return 0;
}


Shell on the results are as follows, don't understand why, after click Ctrl C signal doesn't appear the last sentence is what? :

CodePudding user response:

SIGSTOP/SIGKILL this two signals can't block and block, should be a Ctrl + C directly out of the process, so will not print
  • Related