Which of the following experts can see where the problem is?
Source: Internet
Author: User
Which of the following experts can see what the problem is-General Linux technology-Linux programming and kernel information? The following is a detailed description. # Include "apue. h"
Static void sig_quit (int );
Int main ()
{
Sigset_t newmask, oldmask, pendmask;
If (sigpending (& pendmask) <0)
Err_sys ("sigpending error ");
If (sigismember (& pendmask, SIGQUIT-1) <0)
Printf ("\ nSIGQUIT pending \ n ");
If (sigprocmask (SIG_SETMASK, & oldmask, NULL) <0)
Err_sys ("SIG_SETMASK error ");
Printf ("SIGQUIT unblocked \ n ");
Sleep (5 );
Exit (0 );
}
Static void sig_quit (int signo)
{
Printf ("caught SIGQUIT \ n ");
If (signal (SIGQUIT, SIG_DFL) = SIG_ERR)
Err_sys ("can't reset SIGQUIT ");
}
Press ctrl + \ to output the result:
SIGQUIT pending
Catch SIGQUIT
SIGQUIT unblocked
However, my running result does not output SIGQUIT pending, that is
Catch SIGQUIT
SIGQUIT unblocked
Why?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.