Freud thought: To solve these problems, the parties will have to remember and understand their early childhood experience, to gain insight into the subconscious conflict. Freud's therapy, called "Psychoanalysis" (psychoanalysis), was widely adopted by mental health practitioners for a long time in 20th century. --"Change Your thinking"
Ilocker: Focus on Android Security (new entry, 0 Basics) qq:2597294287
1 #include <signal.h>2void (*signal (intvoid (*func) (int ))) (int);
Sets the signal handler for the signal specified by the Signo. Success returns a function pointer to the previous signal handler, and an error returns SIG_ERR.
If you do not understand the function declaration of signal, you should review the basic (function pointers) of C + +.
Make the declaration of the signal function a bit simpler:
1 void Sigfunc (int// Signal processing function prototype 2 sigfunc * signal (int signo, Sigfunc * func);
Simple example:
1 voidSig_handler (intSigno) {2 if(SIGUSR1 = =Signo)3 printf ("Received SIGUSR1.");4 Else5printf ("Received signal%d. ", Signo);6 }7 8 intMain () {9 if(Sig_err = =signal (SIGUSR1, Sig_handler))Tenprintf ("Can ' tCatchSIGUSR1 "); One A for ( ; ; ) - pause (); -}
The signal processing function can also be set to Sig_ign (indicating that this signal is ignored) or SIG_DFL (indicating the use of the system's default signal handler).
Signal SIGSTOP, SIGKILL cannot be captured or ignored.
The following two points are recorded but not verified and are not determined to be correct:
- Assuming a handler for signal A is being executed, and another signal B comes in, the signal handler for B is transferred, and after processing is completed, a signal handler is then executed.
- There is a soft interrupt signal field in the process, and each bit in the domain corresponds to a signal, and when a signal is received, the corresponding bit is placed. So, for the same signal, the process does not know how many have been received before processing.
In addition to signal, there are sigaction functions that can set signal processing functions, which are more complex than signal, and then write notes later.
Learning materials: Advanced Programming for the UNIX environment
Linux Signal (ii)--signal function