signal.h in C
signal.h in C
The header file named signal.h in Library C defines a type of variable sig_atomic_t, two function calls, and a number of macros to handle the different signals reported during execution of a program.
The variables are defined in signal.h
The following is the type of variable defined in signal.h:
sig_atomic_t : This is an int and is used as a variable in the signal handler. This is an integer type of an object that can be accessed as an atomic entity, even if there are asynchronous signals present.
The macros are defined in signal.h
The following are the macros defined in signal.h and these macros will be used in the two functions listed below. SIG_ macro is used with signal function to define signal functions.
TMTM & Description1 SIG_DFLThis is the default Signal Handler
2 SIG_ERRPerforming a Signal Error
3 SIG_IGNIgnore the signal
The SIG macro is used to represent a digital signal under the following conditions:
STTMacro & Description1 SIGABRTEnd the program abnormally
2 SIGFPEError floating point number as divided by 0
3 SIGILLInvalid operation
4 SIGINTInterrupt signal, such as Ctrl-C
5 SIGSEGVInvalid access to the repository
6 SIGTERMRequest to end
Functions defined in signal.h
Here are some functions defined in signal.h in Library C:
STD & Description1Void function (* signal (int sig, void (* func) (int))) (int)
This function sets a function to handle the signal (eg a signal handler)
2Function int raise (int sig)
This function generates a sig signal. The sig parameter is compatible with the SIG macro
According to Tutorialspoint
Previous article: Library C:
Next lesson: stdarg.h in C
You should read it
- Function signal () in C
- Signal Processing (Signal Handling) in C ++
- How to delete Signal account
- How to use stickers / stickers expressing emotions in Signal
- stdio.h in C
- stdlib.h in C
- What color is the turn signal light? It's easy to think but 90% of people answer wrong
- How to enable Registration Lock in Signal
- Signal and Telegram: Where is the privacy-focused cross-platform chat app better?
- string.h in C
- How to fix 'Input Signal Out of Range' error on Windows
- stdarg.h in C
Maybe you are interested
'Silent' Town: No Wifi, No Mobile Signals for Over 60 Years
Google recommends turning off 2G signals to prevent fraud
AI can analyze radiation from HDMI cable signals to hack data on the screen
Fixed an issue where there was no video signal when the TV was connected via HDMI
Humanoid robot drives itself and obeys traffic signals
The Voyager 1 spacecraft sent signals to Earth for the first time in 5 months