
- Operating System Tutorial
- OS - Home
- OS - Overview
- OS - Components
- OS - Types
- OS - Services
- OS - Properties
- OS - Processes
- OS - Process Scheduling
- OS - Scheduling algorithms
- OS - Multi-threading
- OS - Memory Management
- OS - Virtual Memory
- OS - I/O Hardware
- OS - I/O Software
- OS - File System
- OS - Security
- OS - Linux
- OS - Exams Questions with Answers
- OS - Exams Questions with Answers
- Operating System Useful Resources
- OS - Quick Guide
- OS - Useful Resources
- OS - Discussion
What is user-defined signal handler?
Signals are software interrupts which sent to a program to indicate that an important event has occurred. A Signal may be handled by following one of two possible handlers:
- A default signal handler
- A user-defined signal handler
User-defined signal handler can override this default action that is called to handle the signal. Signals are handled in different ways. Some signals (such as changing the size of a window) are simply ignored; others (such as an illegal memory access) are handled by terminating the program.
A signal handler function may have any name, but must have return type void and have one int parameter.
Example − we might choose the name sigchld_handler for a signal handler for the SIGCHLD signal (termination of a child process). Then the declaration would be −
void sigchld_handler(int sig);
The parameter passed to signal handler is the number of the signal. A programmer may use the same signal handler function to handle several signals.
- Related Articles
- What is default signal handler?
- What are user-defined exceptions in C#?
- PHP User-defined functions
- What are user defined data types in C#?
- User-Defined Exceptions in Python
- User Defined Literals in C++
- User defined bridge on Docker network
- User-defined Custom Exception in C#
- Using User-Defined Variables in MySQL
- C++ set for user defined data type?
- User defined and custom exceptions in Java
- User-defined Exceptions in Python with Examples
- User-defined Exceptions in C# with Example
- Perform MySQL SELECT INTO user-defined variable
- 2D vector in C++ with user defined size
