Whether the process can receive processing signals during processing, the same signal/different signals
Labels
#include <signal.h>#include<stdio.h>#include<stdlib.h>#include<unistd.h>voidSet_signal (intSigno) { if(Signo = =SIGINT) {printf ("%d catch sigint\n", Getpid ()); Sleep (5); printf ("Process the SIGINT finished\n"); } if(signo==SIGTSTP) {printf ("%d catch sigtstp\n", Getpid ()); Sleep (5); printf ("Process the SIGTSTP finished\n"); }}intMain () {if(Signal (sigint,set_signal) = =Sig_err) {printf ("Signal error\n"); return 1; } if(Signal (sigtstp,set_signal) = =Sig_err) {printf ("Signal error\n"); return 1; } //Pause Wait Signal while(1) pause (); }
Compile execution
Process processing in the sending of the same signal, first send CTRL +cin the Send Ctrl + C.catch SIGINT^cprocess the SIGINT finished 3267Catch sigintprocess the SIGINT finished process to send different signals, first send Ctrl+C in the send Ctrl +Zcatch SIGINTcatch sigtstpprocess the SIGTSTP finishedprocess the SIGINT finished
Conclusion
Process processing sends the same signal/different signals will still be processed, but more than 2 processes will block
I. Process and signal unreliable issues